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

Commit b4c13b3d authored by Song Chun Fan's avatar Song Chun Fan
Browse files

[pm] optimize nullableDataDir() flag reading

Attempting to solve native crashes that seem to be caused by this flag reading. This flag is only needed if the app is uninstalled on one user in a multi-user scenario. Optimize the code so that we don't need to check this flag in most of the cases.

Change-Id: I85231efe88d8799e07df2a7339e7740c3a5bac0c
BUG: 307383781
Test: presubmit
parent 2a9682ce
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -1016,8 +1016,8 @@ public class PackageInfoUtils {
            return;
        }

        if (android.content.pm.Flags.nullableDataDir()
                && !state.isInstalled() && !state.dataExists()) {
        if (!state.isInstalled() && !state.dataExists()
                && android.content.pm.Flags.nullableDataDir()) {
            // The data dir has been deleted
            output.dataDir = null;
            return;
@@ -1065,8 +1065,8 @@ public class PackageInfoUtils {
            return;
        }

        if (android.content.pm.Flags.nullableDataDir()
                && !state.isInstalled() && !state.dataExists()) {
        if (!state.isInstalled() && !state.dataExists()
                && android.content.pm.Flags.nullableDataDir()) {
            // The data dir has been deleted
            output.dataDir = null;
            return;
@@ -1113,9 +1113,9 @@ public class PackageInfoUtils {
            return Environment.getDataSystemDirectory();
        }

        if (android.content.pm.Flags.nullableDataDir()
                && !ps.getUserStateOrDefault(userId).isInstalled()
                && !ps.getUserStateOrDefault(userId).dataExists()) {
        if (!ps.getUserStateOrDefault(userId).isInstalled()
                && !ps.getUserStateOrDefault(userId).dataExists()
                && android.content.pm.Flags.nullableDataDir()) {
            // The app has been uninstalled for the user and the data dir has been deleted
            return null;
        }