lineage-sdk: Make styles init at system services ready
*) On pie, lineage system server is starting before overlay manager service so mOverlay was being initialized with null (and crashing). *) Change to only attempt to get service handles after boot phase system services ready. Change-Id: I4965ce6015275a421e2e3864e66e77b8c15477f0
This commit is contained in:
@@ -32,6 +32,8 @@ import android.os.ServiceManager;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.server.SystemService;
|
||||
|
||||
import lineageos.app.LineageContextConstants;
|
||||
import lineageos.providers.LineageSettings;
|
||||
import lineageos.style.IStyleInterface;
|
||||
@@ -70,8 +72,15 @@ public class StyleInterfaceService extends LineageSystemService {
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
mPackageManager = mContext.getPackageManager();
|
||||
mOverlayService = IOverlayManager.Stub.asInterface(ServiceManager.getService("overlay"));
|
||||
/* No-op */
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBootPhase(int phase) {
|
||||
if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) {
|
||||
mPackageManager = mContext.getPackageManager();
|
||||
mOverlayService = IOverlayManager.Stub.asInterface(ServiceManager.getService("overlay"));
|
||||
}
|
||||
}
|
||||
|
||||
private void enforceChangeStylePermission() {
|
||||
@@ -399,4 +408,4 @@ public class StyleInterfaceService extends LineageSystemService {
|
||||
return result;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user