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

Commit a8fefa54 authored by Selim Cinek's avatar Selim Cinek
Browse files

Avoiding heads-up when accessibility is turned on

Bug: 16017019
Change-Id: I08ec75e6b3296eefb9ae5e8fdc9f8dd6c4ad4816
parent 2dbf3eac
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -70,6 +70,7 @@ import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
import android.view.WindowManager;
import android.view.WindowManagerGlobal;
import android.view.WindowManagerGlobal;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.AnimationUtils;
import android.view.animation.AnimationUtils;
import android.widget.DateTimeView;
import android.widget.DateTimeView;
import android.widget.ImageView;
import android.widget.ImageView;
@@ -159,6 +160,7 @@ public abstract class BaseStatusBar extends SystemUI implements
    final protected SparseArray<UserInfo> mCurrentProfiles = new SparseArray<UserInfo>();
    final protected SparseArray<UserInfo> mCurrentProfiles = new SparseArray<UserInfo>();


    protected int mLayoutDirection = -1; // invalid
    protected int mLayoutDirection = -1; // invalid
    protected AccessibilityManager mAccessibilityManager;
    private Locale mLocale;
    private Locale mLocale;
    private float mFontScale;
    private float mFontScale;


@@ -438,6 +440,9 @@ public abstract class BaseStatusBar extends SystemUI implements


        mNotificationData = new NotificationData(this);
        mNotificationData = new NotificationData(this);


        mAccessibilityManager = (AccessibilityManager)
                mContext.getSystemService(Context.ACCESSIBILITY_SERVICE);

        mDreamManager = IDreamManager.Stub.asInterface(
        mDreamManager = IDreamManager.Stub.asInterface(
                ServiceManager.checkService(DreamService.DREAM_SERVICE));
                ServiceManager.checkService(DreamService.DREAM_SERVICE));
        mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
        mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
@@ -1965,10 +1970,13 @@ public abstract class BaseStatusBar extends SystemUI implements
        boolean hasTicker = mHeadsUpTicker && !TextUtils.isEmpty(notification.tickerText);
        boolean hasTicker = mHeadsUpTicker && !TextUtils.isEmpty(notification.tickerText);
        boolean isAllowed = notification.extras.getInt(Notification.EXTRA_AS_HEADS_UP,
        boolean isAllowed = notification.extras.getInt(Notification.EXTRA_AS_HEADS_UP,
                Notification.HEADS_UP_ALLOWED) != Notification.HEADS_UP_NEVER;
                Notification.HEADS_UP_ALLOWED) != Notification.HEADS_UP_NEVER;
        boolean accessibilityForcesLaunch = isFullscreen
                && mAccessibilityManager.isTouchExplorationEnabled();


        final KeyguardTouchDelegate keyguard = KeyguardTouchDelegate.getInstance(mContext);
        final KeyguardTouchDelegate keyguard = KeyguardTouchDelegate.getInstance(mContext);
        boolean interrupt = (isFullscreen || (isHighPriority && (isNoisy || hasTicker)))
        boolean interrupt = (isFullscreen || (isHighPriority && (isNoisy || hasTicker)))
                && isAllowed
                && isAllowed
                && !accessibilityForcesLaunch
                && mPowerManager.isScreenOn()
                && mPowerManager.isScreenOn()
                && !keyguard.isShowingAndNotOccluded()
                && !keyguard.isShowingAndNotOccluded()
                && !keyguard.isInputRestricted();
                && !keyguard.isInputRestricted();
+0 −5
Original line number Original line Diff line number Diff line
@@ -1078,7 +1078,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
    };
    };


    private long mLastLockToAppLongPress;
    private long mLastLockToAppLongPress;
    private AccessibilityManager mAccessibilityManager;
    private View.OnLongClickListener mLongPressBackRecentsListener =
    private View.OnLongClickListener mLongPressBackRecentsListener =
            new View.OnLongClickListener() {
            new View.OnLongClickListener() {
        @Override
        @Override
@@ -3869,10 +3868,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        try {
        try {
            boolean sendBackLongPress = false;
            boolean sendBackLongPress = false;
            IActivityManager activityManager = ActivityManagerNative.getDefault();
            IActivityManager activityManager = ActivityManagerNative.getDefault();
            if (mAccessibilityManager == null) {
                mAccessibilityManager = (AccessibilityManager)
                        mContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
            }
            boolean isAccessiblityEnabled = mAccessibilityManager.isEnabled();
            boolean isAccessiblityEnabled = mAccessibilityManager.isEnabled();
            if (activityManager.isInLockTaskMode() && !isAccessiblityEnabled) {
            if (activityManager.isInLockTaskMode() && !isAccessiblityEnabled) {
                long time = System.currentTimeMillis();
                long time = System.currentTimeMillis();