Alright here is the details of how to port UPSM on lollipop rom
First, be sure that you are on a deodexed rom, otherwise search to the XDA about how to deodex your rom(its easy)
Download ApkTool (attached zip file)
Download Emergency apps(attached zip file)
Pull from your phone the services.jar located in /system/frameworks
Open the file services.jar with 7zip or winrar and extract the file classes.dex to the root of apktool
Drag and drop the classes.dex to the cmd file Quick-Baksmali.cmd
Wait for it to finish
Open the newly created folder Classout and go to classout\com\android\server
Open with notepad++ or other text editor the file SystemServer.smali
Search with the keyword "emergency" and you will find 1 result.
Delete the following result starting from - and ending to ...
Code:
.method static final startEmergencyModeService(Landroid/content/Context;)V
.
.
.
.end method
Now add right here this code
Code:
.method static final startEmergencyModeService(Landroid/content/Context;)V
.registers 6
.parameter "context"
.prologue
.line 2194
:try_start_0
invoke-static {p0}, Lcom/sec/android/emergencymode/EmergencyManager;->getInstance(Landroid/content/Context;)Lcom/sec/android/emergencymode/EmergencyManager;
move-result-object v1
.line 2195
.local v1, emMgr:Lcom/sec/android/emergencymode/EmergencyManager;
invoke-virtual {v1}, Lcom/sec/android/emergencymode/EmergencyManager;->readyEmergencyMode()V
:try_end_7
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_7} :catch_8
.line 2200
.end local v1 #emMgr:Lcom/sec/android/emergencymode/EmergencyManager;
:goto_7
return-void
.line 2196
:catch_8
move-exception v0
.line 2197
.local v0, e:Ljava/lang/Exception;
const-string v2, "SystemServer"
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "Starting emergency service failed: "
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v3
invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v3
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v3
invoke-static {v2, v3}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I
goto :goto_7
.end method
Save this file, and drag n drop the hole folder Classout to the cmd file Quick-Smali.cmd
It will generate a new file named new-classes.dex
Open again services.jar with 7zip or winrar, delete the classes.dex file and insert this newly created dex file, rename it classes.dex and push this file to the device, overwriting the stock services.jar file
DO NOT forget to set permissions rw-r--r--
Copy all the files in the 1st attached zip to /system/apps/ and set the appropriate permissions
After this, you will be able to enable UPSM from the settings mod in post #1 and you can also add it to notification bar with SQLite editor
To do this you must go to settings storage,settings.DB,system and search for notification
Edit the following "notification_panel_active_app_list_for_reset" ,and after the last semicolon(

add this
Go to notification settings and restore the buttons and the U.Power saving button will appear
Reboot and everything will work if you followed the whole procedure right
What is not working
While in UPSM, you may not hear voice during a call. Trying to fix it. Stay on for an update