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

Commit e7e55645 authored by Zimuzo Ezeozue's avatar Zimuzo Ezeozue Committed by Android (Google) Code Review
Browse files

Merge "Kill app when OP_REQUEST_INSTALL_PACKAGES is changed."

parents e9437d2e 28ec85a3
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -4322,6 +4322,19 @@ class StorageManagerService extends IStorageManager.Stub

        public void onAppOpsChanged(int code, int uid,
                @Nullable String packageName, int mode) {
            if (code == OP_REQUEST_INSTALL_PACKAGES && mIsFuseEnabled) {
                // When using FUSE, we basically have no other choice but to kill the app
                // after the app op is either granted or rejected.
                final IActivityManager am = ActivityManager.getService();
                try {
                    am.killApplication(packageName,
                            UserHandle.getAppId(uid),
                            UserHandle.USER_ALL, AppOpsManager.opToName(code) + " changed.");
                } catch (RemoteException e) {
                }

                return;
            }
            if (mode == MODE_ALLOWED && (code == OP_READ_EXTERNAL_STORAGE
                    || code == OP_WRITE_EXTERNAL_STORAGE
                    || code == OP_REQUEST_INSTALL_PACKAGES)) {