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

Commit 230e19d9 authored by Jesse Chan's avatar Jesse Chan Committed by Luca Stefani
Browse files

SystemUI: set no hint overlay to highest priority



As overlays are also used to apply navigation mode, it is needed to set
our customization overlay to highest priority to ensure it is applied.

Change-Id: I41ca4b7ea99fea9f62d2e8ece5114f682e8e7fe9
Signed-off-by: default avatarJesse Chan <jc@lineageos.org>
parent ac2040ad
Loading
Loading
Loading
Loading
+13 −6
Original line number Original line Diff line number Diff line
@@ -21,10 +21,11 @@ import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Context;
import android.content.om.OverlayManager;
import android.content.om.IOverlayManager;
import android.content.res.Configuration;
import android.content.res.Configuration;
import android.graphics.drawable.Icon;
import android.graphics.drawable.Icon;
import android.os.UserHandle;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Log;
import android.util.SparseArray;
import android.util.SparseArray;
@@ -264,12 +265,18 @@ public class NavigationBarInflaterView extends FrameLayout
    }
    }


    private void updateHint() {
    private void updateHint() {
        final IOverlayManager iom = IOverlayManager.Stub.asInterface(
                ServiceManager.getService(Context.OVERLAY_SERVICE));
        final boolean state = mNavBarMode == NAV_BAR_MODE_GESTURAL && !mIsHintEnabled;
        final boolean state = mNavBarMode == NAV_BAR_MODE_GESTURAL && !mIsHintEnabled;
        UserHandle userId = UserHandle.of(ActivityManager.getCurrentUser());
        final int userId = ActivityManager.getCurrentUser();
        try {
        try {
            mContext.getSystemService(OverlayManager.class).setEnabled(
            iom.setEnabled(OVERLAY_NAVIGATION_HIDE_HINT, state, userId);
                    OVERLAY_NAVIGATION_HIDE_HINT, state, userId);
            if (state) {
        } catch (Exception e) {
                // As overlays are also used to apply navigation mode, it is needed to set
                // our customization overlay to highest priority to ensure it is applied.
                iom.setHighestPriority(OVERLAY_NAVIGATION_HIDE_HINT, userId);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Failed to " + (state ? "enable" : "disable")
            Log.e(TAG, "Failed to " + (state ? "enable" : "disable")
                    + " overlay " + OVERLAY_NAVIGATION_HIDE_HINT + " for user " + userId);
                    + " overlay " + OVERLAY_NAVIGATION_HIDE_HINT + " for user " + userId);
        }
        }