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

Commit 57be6226 authored by Pavel Grafov's avatar Pavel Grafov
Browse files

Guard ACTION_PROFILE_INACCESSIBLE with version check

Bug: 277715473
Test: Treehugger
Change-Id: Ie950c6e92ee29b80f25a1aa1f8b85dcfdcc28c3f
parent 5ed0d0ce
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -92,6 +92,15 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi

    static final String TAG = "Launcher.Model";

    // Broadcast intent to track when the profile gets locked:
    // ACTION_MANAGED_PROFILE_UNAVAILABLE can be used until Android U where profile no longer gets
    // locked when paused.
    // ACTION_PROFILE_INACCESSIBLE always means that the profile is getting locked but it only
    // appeared in Android S.
    private static final String ACTION_PROFILE_LOCKED = Utilities.ATLEAST_U
            ? Intent.ACTION_PROFILE_INACCESSIBLE
            : Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE;

    @NonNull
    private final LauncherAppState mApp;
    @NonNull
@@ -290,9 +299,9 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi
            // If we have changed locale we need to clear out the labels in all apps/workspace.
            forceReload();
        } else if (Intent.ACTION_MANAGED_PROFILE_AVAILABLE.equals(action)
                || Intent.ACTION_PROFILE_INACCESSIBLE.equals(action)
                || Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE.equals(action)
                || Intent.ACTION_MANAGED_PROFILE_UNLOCKED.equals(action)) {
                || Intent.ACTION_MANAGED_PROFILE_UNLOCKED.equals(action)
                || Intent.ACTION_PROFILE_INACCESSIBLE.equals(action)) {
            UserHandle user = intent.getParcelableExtra(Intent.EXTRA_USER);
            if (TestProtocol.sDebugTracing) {
                Log.d(TestProtocol.WORK_TAB_MISSING, "onBroadcastIntent intentAction: " + action +
@@ -305,9 +314,7 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi
                            PackageUpdatedTask.OP_USER_AVAILABILITY_CHANGE, user));
                }

                // ACTION_PROFILE_INACCESSIBLE sends the profile back to locked mode, so
                // we need to run the state change task again.
                if (Intent.ACTION_PROFILE_INACCESSIBLE.equals(action)
                if (ACTION_PROFILE_LOCKED.equals(action)
                        || Intent.ACTION_MANAGED_PROFILE_UNLOCKED.equals(action)) {
                    enqueueModelUpdateTask(new UserLockStateChangedTask(
                            user, Intent.ACTION_MANAGED_PROFILE_UNLOCKED.equals(action)));