i'm trying to set a LineageOS system profile by a tasker task. I found some examples for CM13 but i can't get it work on LineagesOS. I'm not much into Java.
What have i done so far...
Created a Tasker task "Java Function": proman = cyanogenmod.app.ProfileManager.getInstance{cyanogenmod.app.ProfileManager} (Context)
Second "Java Function": proman.setActiveProfile( %Newprofile )
Value of %Newprofile = "4G"
But i get the following error in my tasker log:
> 11.30.17/E Java Function: ->
> 11.30.17/JU analyse: target: proman expected: null
> 11.30.17/JU target: analyse done: proman: class: cyanogenmod.app.ProfileManager obj: cyanogenmod.app.ProfileManager@1f3308e partWithoutMods: null static: false const false casted: false
> 11.30.17/JU analyse: returnval: java.lang.Void expected: null
> 11.30.17/JU returnval: analyse done: java.lang.Void: class: java.lang.Void obj: null partWithoutMods: null static: true const false casted: false
> 11.30.17/JU initClass: class: java.lang.Void obj: null partWithoutMods: java.lang.Void static: true const false casted: false
> 11.30.17/JU initClass: retnovar: init with array handling -> class java.lang.Void
> 11.30.17/JU initClass: class: cyanogenmod.app.ProfileManager obj: cyanogenmod.app.ProfileManager@1f3308e partWithoutMods: proman static: false const false casted: false
> 11.30.17/JU initclass: target: use object class: cyanogenmod.app.ProfileManager
> 11.30.17/JU analyse: param0: %Newprofile expected: class java.lang.String
> 11.30.17/Variables doreplresult: |%Newprofile| -> |4G|
> 11.30.17/JU param0: analyse done: %Newprofile: class: java.lang.String obj: 4G partWithoutMods: null static: false const true casted: false
> 11.30.17/E param 0 class: class java.lang.String
> 11.30.17/E targetClass: class cyanogenmod.app.ProfileManager
> 11.30.17/E object: cyanogenmod.app.ProfileManager@1f3308e
> 11.30.17/E method: public void cyanogenmod.app.ProfileManager.setActiveProfile(java.lang.String)
> 11.30.17/E arg0 class java.lang.String value 4G
> 11.30.17/E Java Function: java.lang.reflect.InvocationTargetException
> 11.30.17/ Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'boolean cyanogenmod.app.IProfileManager.setActiveProfileByName(java.lang.String)' on a null object reference
> 11.30.17/ cyanogenmod.app.ProfileManager.setActiveProfile(Unknown Source)
> 11.30.17/ java.lang.reflect.Method.invoke(Native Method)
> 11.30.17/ net.dinglisch.android.taskerm.ExecuteService.c(Unknown Source)
> 11.30.17/ net.dinglisch.android.taskerm.ExecuteService.a(Unknown Source)
> 11.30.17/ net.dinglisch.android.taskerm.ExecuteService.a(Unknown Source)
> 11.30.17/ net.dinglisch.android.taskerm.fd.run(Unknown Source)
> 11.30.17/E result: stop task (error)
> 11.30.17/E Error: 1
> 11.30.17/MacroEdit action finished exeID 1 action no 1 code 664 status: Err next 1
Can anyone give ma a hint to narrow down my error? I guess something is wrong with the creation of the object "proman".
Thanks.
EDIT: Source of the Class - https://github.com/LineageOS/cm_platform_sdk/blob/cm-14.1/sdk/src/java/cyanogenmod/app/ProfileManager.java