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

Commit 0b925d4f authored by Nate Myren's avatar Nate Myren
Browse files

Null safe package name in AppOps writeState

Ensure that, if a package has a null package name, that the AppOpsServer
does not crash. Existing package tags should be closed, and lastPkg set
to null.

Test: manual
Fixes: 193664388
Change-Id: I420477a9f102b6c1f8305b45158e7bdb3a71e227
parent e684a19b
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -5099,14 +5099,16 @@ public class AppOpsService extends IAppOpsService.Stub {
                    String lastPkg = null;
                    for (int i=0; i<allOps.size(); i++) {
                        AppOpsManager.PackageOps pkg = allOps.get(i);
                        if (!pkg.getPackageName().equals(lastPkg)) {
                        if (!Objects.equals(pkg.getPackageName(), lastPkg)) {
                            if (lastPkg != null) {
                                out.endTag(null, "pkg");
                            }
                            lastPkg = pkg.getPackageName();
                            if (lastPkg != null) {
                                out.startTag(null, "pkg");
                                out.attribute(null, "n", lastPkg);
                            }
                        }
                        out.startTag(null, "uid");
                        out.attributeInt(null, "n", pkg.getUid());
                        List<AppOpsManager.OpEntry> ops = pkg.getOps();