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

Commit 4052224e authored by Automerger Merge Worker's avatar Automerger Merge Worker Committed by Android (Google) Code Review
Browse files

Merge "Merge "Fix work tile setup when adding work profile" into tm-qpr-dev...

Merge "Merge "Fix work tile setup when adding work profile" into tm-qpr-dev am: 52009a5c am: e806063b"
parents b0dd1496 0bb8f3de
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ public interface QSHost {
    void removeCallback(Callback callback);
    void removeTile(String tileSpec);
    void removeTiles(Collection<String> specs);
    void unmarkTileAsAutoAdded(String tileSpec);

    int indexOf(String tileSpec);

+0 −5
Original line number Diff line number Diff line
@@ -427,11 +427,6 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P
        mMainExecutor.execute(() -> changeTileSpecs(tileSpecs -> tileSpecs.removeAll(specs)));
    }

    @Override
    public void unmarkTileAsAutoAdded(String spec) {
        if (mAutoTiles != null) mAutoTiles.unmarkTileAsAutoAdded(spec);
    }

    /**
     * Add a tile to the end
     *
+0 −1
Original line number Diff line number Diff line
@@ -101,7 +101,6 @@ public class WorkModeTile extends QSTileImpl<BooleanState> implements
    @MainThread
    public void onManagedProfileRemoved() {
        mHost.removeTile(getTileSpec());
        mHost.unmarkTileAsAutoAdded(getTileSpec());
    }

    @Override
+2 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ open class UserTrackerImpl internal constructor(
            // These get called when a managed profile goes in or out of quiet mode.
            addAction(Intent.ACTION_MANAGED_PROFILE_AVAILABLE)
            addAction(Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE)

            addAction(Intent.ACTION_MANAGED_PROFILE_ADDED)
            addAction(Intent.ACTION_MANAGED_PROFILE_REMOVED)
            addAction(Intent.ACTION_MANAGED_PROFILE_UNLOCKED)
        }
@@ -128,6 +128,7 @@ open class UserTrackerImpl internal constructor(
            Intent.ACTION_USER_INFO_CHANGED,
            Intent.ACTION_MANAGED_PROFILE_AVAILABLE,
            Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE,
            Intent.ACTION_MANAGED_PROFILE_ADDED,
            Intent.ACTION_MANAGED_PROFILE_REMOVED,
            Intent.ACTION_MANAGED_PROFILE_UNLOCKED -> {
                handleProfilesChanged()
+7 −9
Original line number Diff line number Diff line
@@ -154,9 +154,7 @@ public class AutoTileManager implements UserAwareController {
        if (!mAutoTracker.isAdded(SAVER)) {
            mDataSaverController.addCallback(mDataSaverListener);
        }
        if (!mAutoTracker.isAdded(WORK)) {
        mManagedProfileController.addCallback(mProfileCallback);
        }
        if (!mAutoTracker.isAdded(NIGHT)
                && ColorDisplayManager.isNightDisplayAvailable(mContext)) {
            mNightDisplayListener.setCallback(mNightDisplayCallback);
@@ -275,18 +273,18 @@ public class AutoTileManager implements UserAwareController {
        return mCurrentUser.getIdentifier();
    }

    public void unmarkTileAsAutoAdded(String tabSpec) {
        mAutoTracker.setTileRemoved(tabSpec);
    }

    private final ManagedProfileController.Callback mProfileCallback =
            new ManagedProfileController.Callback() {
                @Override
                public void onManagedProfileChanged() {
                    if (mAutoTracker.isAdded(WORK)) return;
                    if (mManagedProfileController.hasActiveProfile()) {
                        if (mAutoTracker.isAdded(WORK)) return;
                        mHost.addTile(WORK);
                        mAutoTracker.setTileAdded(WORK);
                    } else {
                        if (!mAutoTracker.isAdded(WORK)) return;
                        mHost.removeTile(WORK);
                        mAutoTracker.setTileRemoved(WORK);
                    }
                }

@@ -429,7 +427,7 @@ public class AutoTileManager implements UserAwareController {
                initSafetyTile();
            } else if (!isSafetyCenterEnabled && mAutoTracker.isAdded(mSafetySpec)) {
                mHost.removeTile(mSafetySpec);
                mHost.unmarkTileAsAutoAdded(mSafetySpec);
                mAutoTracker.setTileRemoved(mSafetySpec);
            }
        }
    };
Loading