Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d56c6bdf authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Don't use Context#getApplicationContext

as this might be null. In PermissionControllerManager we need a context
that outlives the passed in context as we bind to a service that will
only get destroyed after a delay.

Test: atest PermissionControllerTest
Bug: 131356152
Change-Id: Iabeac669f6464b84a4b9e8f9b2a27959b116c25b
parent c74d6b56
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.TestApi;
import android.app.ActivityThread;
import android.app.admin.DevicePolicyManager.PermissionGrantState;
import android.content.ComponentName;
import android.content.Context;
@@ -232,7 +233,7 @@ public final class PermissionControllerManager {
                intent.setPackage(context.getPackageManager().getPermissionControllerPackageName());
                ResolveInfo serviceInfo = context.getPackageManager().resolveService(intent, 0);

                remoteService = new RemoteService(context.getApplicationContext(),
                remoteService = new RemoteService(ActivityThread.currentApplication(),
                        serviceInfo.getComponentInfo().getComponentName(), handler,
                        context.getUser());
                sRemoteServices.put(key, remoteService);