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

Commit 1592073e authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[appops] Fix opChanged null String" into main

parents 33772671 6497645a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2004,7 +2004,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                new IAppOpsCallback.Stub() {
                    @Override public void opChanged(int op, int uid, String packageName,
                            String persistentDeviceId) {
                        if (op == AppOpsManager.OP_RUN_IN_BACKGROUND && packageName != null) {
                        if (op == AppOpsManager.OP_RUN_IN_BACKGROUND && uid >= 0) {
                            if (getAppOpsManager().checkOpNoThrow(op, uid, packageName)
                                    != AppOpsManager.MODE_ALLOWED) {
                                runInBackgroundDisabled(uid);
+1 −0
Original line number Diff line number Diff line
@@ -394,6 +394,7 @@ final class AppPermissionTracker extends BaseAppStateTracker<AppPermissionPolicy
    private class MyAppOpsCallback extends IAppOpsCallback.Stub {
        @Override
        public void opChanged(int op, int uid, String packageName, String persistentDeviceId) {
            if (uid < 0) return;
            mHandler.obtainMessage(MyHandler.MSG_APPOPS_CHANGED, op, uid, packageName)
                    .sendToTarget();
        }
+2 −1
Original line number Diff line number Diff line
@@ -822,7 +822,8 @@ public class AppOpsService extends IAppOpsService.Stub {
        @Override
        public void onOpModeChanged(int op, int uid, String packageName, String persistentDeviceId)
                throws RemoteException {
            mCallback.opChanged(op, uid, packageName, persistentDeviceId);
            mCallback.opChanged(op, uid, packageName != null ? packageName : "",
                    Objects.requireNonNull(persistentDeviceId));
        }
    }

+3 −6
Original line number Diff line number Diff line
@@ -235,15 +235,12 @@ public final class PermissionPolicyService extends SystemService {
                this::synchronizeUidPermissionsAndAppOpsAsync);

        mAppOpsCallback = new IAppOpsCallback.Stub() {
            public void opChanged(int op, int uid, @Nullable String packageName,
                    String persistentDeviceId) {
            public void opChanged(int op, int uid, String packageName, String persistentDeviceId) {
                if (!Objects.equals(persistentDeviceId,
                        VirtualDeviceManager.PERSISTENT_DEVICE_ID_DEFAULT)) {
                        VirtualDeviceManager.PERSISTENT_DEVICE_ID_DEFAULT) || uid < 0) {
                    return;
                }
                if (packageName != null) {
                synchronizeUidPermissionsAndAppOpsAsync(uid);
                }
                resetAppOpPermissionsIfNotRequestedForUidAsync(uid);
            }
        };