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

Commit 9bb3f678 authored by Jorge Ruesga's avatar Jorge Ruesga Committed by Steve Kondik
Browse files

appops: do not prune apps that are not present

Do not prune apps that are not currently present in the device (like sdcards ones). During
booting sdcards are not available but must not be purge from appops, because they are still
present in the android app database.
JIRA: CYAN-2811
Issue: https://jira.cyanogenmod.org/browse/CYAN-2811



Change-Id: I6680cbdf0022812b45d966dffee754399e92accb
Signed-off-by: default avatarJorge Ruesga <jorge@ruesga.com>
parent 2927ef20
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -272,12 +272,19 @@ public class AppOpsService extends IAppOpsService.Stub {
                        }
                    }
                    if (curUid != ops.uid) {
                        // Do not prune apps that are not currently present in the device
                        // (like sdcards ones). During booting sdcards are not available but
                        // must not be purge from appops, because they are still present
                        // in the android app database.
                        String pkgName = mContext.getPackageManager().getNameForUid(ops.uid);
                        if (curUid != -1 || pkgName == null || !pkgName.equals(ops.packageName)) {
                            Slog.i(TAG, "Pruning old package " + ops.packageName
                                    + "/" + ops.uid + ": new uid=" + curUid);
                            it.remove();
                            changed = true;
                        }
                    }
                }
                if (pkgs.size() <= 0) {
                    mUidOps.removeAt(i);
                }