diff options
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui')
17 files changed, 360 insertions, 132 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistGestureManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java index d9f2324..d1f8963 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/AssistGestureManager.java +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java @@ -33,11 +33,11 @@ import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.phone.PhoneStatusBar; /** - * Class to manage everything around the assist gesture. + * Class to manage everything related to assist in SystemUI. */ -public class AssistGestureManager { +public class AssistManager { - private static final String TAG = "AssistGestureManager"; + private static final String TAG = "AssistManager"; private static final String ASSIST_ICON_METADATA_NAME = "com.android.systemui.action_assist_icon"; @@ -77,7 +77,7 @@ public class AssistGestureManager { } }; - public AssistGestureManager(PhoneStatusBar bar, Context context) { + public AssistManager(PhoneStatusBar bar, Context context) { mContext = context; mBar = bar; mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); @@ -194,6 +194,14 @@ public class AssistGestureManager { } } + public void launchVoiceAssistFromKeyguard() { + try { + mVoiceInteractionManagerService.launchVoiceAssistFromKeyguard(); + } catch (RemoteException e) { + Log.w(TAG, "Failed to call launchVoiceAssistFromKeyguard", e); + } + } + private boolean getVoiceInteractorSupportsAssistGesture() { try { return mVoiceInteractionManagerService.activeServiceSupportsAssist(); @@ -203,7 +211,16 @@ public class AssistGestureManager { } } - private ComponentName getVoiceInteractorComponentName() { + public boolean canVoiceAssistBeLaunchedFromKeyguard() { + try { + return mVoiceInteractionManagerService.activeServiceSupportsLaunchFromKeyguard(); + } catch (RemoteException e) { + Log.w(TAG, "Failed to call activeServiceSupportsLaunchFromKeyguard", e); + return false; + } + } + + public ComponentName getVoiceInteractorComponentName() { try { return mVoiceInteractionManagerService.getActiveServiceComponentName(); } catch (RemoteException e) { diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java index 1001feb..ad97f91 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java @@ -39,7 +39,6 @@ import com.android.systemui.R; import com.android.systemui.recents.misc.DebugTrigger; import com.android.systemui.recents.misc.ReferenceCountedTrigger; import com.android.systemui.recents.misc.SystemServicesProxy; -import com.android.systemui.recents.misc.Utilities; import com.android.systemui.recents.model.RecentsTaskLoadPlan; import com.android.systemui.recents.model.RecentsTaskLoader; import com.android.systemui.recents.model.Task; @@ -392,15 +391,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView filter.addAction(Intent.ACTION_SCREEN_OFF); filter.addAction(SearchManager.INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED); registerReceiver(mSystemBroadcastReceiver, filter); - - // Private API calls to make the shadows look better - try { - Utilities.setShadowProperty("ambientRatio", String.valueOf(1.5f)); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (InvocationTargetException e) { - e.printStackTrace(); - } } /** Inflates the debug overlay if debug mode is enabled. */ diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/Utilities.java b/packages/SystemUI/src/com/android/systemui/recents/misc/Utilities.java index 84544ff..e810410 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/misc/Utilities.java +++ b/packages/SystemUI/src/com/android/systemui/recents/misc/Utilities.java @@ -22,27 +22,11 @@ import android.graphics.Matrix; import android.graphics.Rect; import android.view.View; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.ArrayList; /* Common code */ public class Utilities { - // Reflection methods for altering shadows - private static Method sPropertyMethod; - static { - try { - Class<?> c = Class.forName("android.view.DisplayListCanvas"); - sPropertyMethod = c.getDeclaredMethod("setProperty", String.class, String.class); - if (!sPropertyMethod.isAccessible()) sPropertyMethod.setAccessible(true); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - } - } - /** Scales a rect about its centroid */ public static void scaleRectAboutCenter(Rect r, float scale) { if (scale != 1.0f) { @@ -163,12 +147,6 @@ public class Utilities { (1f - overlayAlpha) * Color.blue(overlayColor))); } - /** Sets some private shadow properties. */ - public static void setShadowProperty(String property, String value) - throws IllegalAccessException, InvocationTargetException { - sPropertyMethod.invoke(null, property, value); - } - /** * Cancels an animation ensuring that if it has listeners, onCancel and onEnd * are not called. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java index e632cc8..17e2cb5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java @@ -59,13 +59,6 @@ public abstract class ExpandableView extends FrameLayout { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int ownMaxHeight = mMaxViewHeight; - int heightMode = MeasureSpec.getMode(heightMeasureSpec); - boolean hasFixedHeight = heightMode == MeasureSpec.EXACTLY; - boolean isHeightLimited = heightMode == MeasureSpec.AT_MOST; - if (hasFixedHeight || isHeightLimited) { - int size = MeasureSpec.getSize(heightMeasureSpec); - ownMaxHeight = Math.min(ownMaxHeight, size); - } int newHeightSpec = MeasureSpec.makeMeasureSpec(ownMaxHeight, MeasureSpec.AT_MOST); int maxChildHeight = 0; int childCount = getChildCount(); @@ -92,8 +85,7 @@ public abstract class ExpandableView extends FrameLayout { mMatchParentViews.add(child); } } - int ownHeight = hasFixedHeight ? ownMaxHeight : - isHeightLimited ? Math.min(ownMaxHeight, maxChildHeight) : maxChildHeight; + int ownHeight = Math.min(ownMaxHeight, maxChildHeight); newHeightSpec = MeasureSpec.makeMeasureSpec(ownHeight, MeasureSpec.EXACTLY); for (View child : mMatchParentViews) { child.measure(getChildMeasureSpec( diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarter.java index 23810f9..ee5eb38 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarter.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarter.java @@ -25,4 +25,5 @@ import android.content.Intent; */ public interface ActivityStarter { public void startActivity(Intent intent, boolean dismissShade); + void preventNextAnimation(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java index 8343497..8bffdc9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java @@ -131,6 +131,10 @@ public class KeyguardAffordanceHelper { mCenterIcon = mCallback.getCenterIcon(); mRightIcon = mCallback.getRightIcon(); mRightIcon.setIsLeft(false); + updatePreviews(); + } + + public void updatePreviews() { mLeftIcon.setPreviewView(mCallback.getLeftPreview()); mRightIcon.setPreviewView(mCallback.getRightPreview()); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java index fabc1a6..efc3ea0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -25,17 +25,13 @@ import android.content.IntentFilter; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.res.Configuration; -import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.graphics.drawable.InsetDrawable; -import android.hardware.fingerprint.FingerprintManager; import android.os.AsyncTask; import android.os.Bundle; import android.os.RemoteException; import android.os.UserHandle; -import android.os.Vibrator; import android.provider.MediaStore; -import android.provider.Settings; import android.telecom.TelecomManager; import android.util.AttributeSet; import android.util.Log; @@ -54,6 +50,7 @@ import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.systemui.EventLogConstants; import com.android.systemui.EventLogTags; import com.android.systemui.R; +import com.android.systemui.assist.AssistManager; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.KeyguardAffordanceView; import com.android.systemui.statusbar.KeyguardIndicationController; @@ -85,12 +82,12 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private static final long TRANSIENT_FP_ERROR_TIMEOUT = 1300; private KeyguardAffordanceView mCameraImageView; - private KeyguardAffordanceView mPhoneImageView; + private KeyguardAffordanceView mLeftAffordanceView; private LockIcon mLockIcon; private TextView mIndicationText; private ViewGroup mPreviewContainer; - private View mPhonePreview; + private View mLeftPreview; private View mCameraPreview; private ActivityStarter mActivityStarter; @@ -104,6 +101,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private final Interpolator mLinearOutSlowInInterpolator; private boolean mPrewarmSent; + private boolean mLeftIsVoiceAssist; + private AssistManager mAssistManager; public KeyguardBottomAreaView(Context context) { this(context, null); @@ -133,8 +132,12 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL label = getResources().getString(R.string.unlock_label); } else if (host == mCameraImageView) { label = getResources().getString(R.string.camera_label); - } else if (host == mPhoneImageView) { - label = getResources().getString(R.string.phone_label); + } else if (host == mLeftAffordanceView) { + if (mLeftIsVoiceAssist) { + label = getResources().getString(R.string.voice_assist_label); + } else { + label = getResources().getString(R.string.phone_label); + } } info.addAction(new AccessibilityAction(ACTION_CLICK, label)); } @@ -149,8 +152,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL } else if (host == mCameraImageView) { launchCamera(); return true; - } else if (host == mPhoneImageView) { - launchPhone(); + } else if (host == mLeftAffordanceView) { + launchLeftAffordance(); return true; } } @@ -164,29 +167,28 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL mLockPatternUtils = new LockPatternUtils(mContext); mPreviewContainer = (ViewGroup) findViewById(R.id.preview_container); mCameraImageView = (KeyguardAffordanceView) findViewById(R.id.camera_button); - mPhoneImageView = (KeyguardAffordanceView) findViewById(R.id.phone_button); + mLeftAffordanceView = (KeyguardAffordanceView) findViewById(R.id.left_button); mLockIcon = (LockIcon) findViewById(R.id.lock_icon); mIndicationText = (TextView) findViewById(R.id.keyguard_indication_text); watchForCameraPolicyChanges(); updateCameraVisibility(); - updatePhoneVisibility(); mUnlockMethodCache = UnlockMethodCache.getInstance(getContext()); mUnlockMethodCache.addListener(this); mLockIcon.update(); setClipChildren(false); setClipToPadding(false); mPreviewInflater = new PreviewInflater(mContext, new LockPatternUtils(mContext)); - inflatePreviews(); + inflateCameraPreview(); mLockIcon.setOnClickListener(this); mLockIcon.setOnLongClickListener(this); mCameraImageView.setOnClickListener(this); - mPhoneImageView.setOnClickListener(this); + mLeftAffordanceView.setOnClickListener(this); initAccessibility(); } private void initAccessibility() { mLockIcon.setAccessibilityDelegate(mAccessibilityDelegate); - mPhoneImageView.setAccessibilityDelegate(mAccessibilityDelegate); + mLeftAffordanceView.setAccessibilityDelegate(mAccessibilityDelegate); mCameraImageView.setAccessibilityDelegate(mAccessibilityDelegate); } @@ -247,9 +249,26 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL mCameraImageView.setVisibility(visible ? View.VISIBLE : View.GONE); } - private void updatePhoneVisibility() { - boolean visible = isPhoneVisible(); - mPhoneImageView.setVisibility(visible ? View.VISIBLE : View.GONE); + private void updateLeftAffordanceIcon() { + mLeftIsVoiceAssist = canLaunchVoiceAssist(); + int drawableId; + int contentDescription; + if (mLeftIsVoiceAssist) { + mLeftAffordanceView.setVisibility(View.VISIBLE); + drawableId = R.drawable.ic_mic_26dp; + contentDescription = R.string.accessibility_voice_assist_button; + } else { + boolean visible = isPhoneVisible(); + mLeftAffordanceView.setVisibility(visible ? View.VISIBLE : View.GONE); + drawableId = R.drawable.ic_phone_24dp; + contentDescription = R.string.accessibility_phone_button; + } + mLeftAffordanceView.setImageDrawable(mContext.getDrawable(drawableId)); + mLeftAffordanceView.setContentDescription(mContext.getString(contentDescription)); + } + + public boolean isLeftVoiceAssist() { + return mLeftIsVoiceAssist; } private boolean isPhoneVisible() { @@ -287,9 +306,9 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL @Override public void onStateChanged(boolean accessibilityEnabled, boolean touchExplorationEnabled) { mCameraImageView.setClickable(touchExplorationEnabled); - mPhoneImageView.setClickable(touchExplorationEnabled); + mLeftAffordanceView.setClickable(touchExplorationEnabled); mCameraImageView.setFocusable(accessibilityEnabled); - mPhoneImageView.setFocusable(accessibilityEnabled); + mLeftAffordanceView.setFocusable(accessibilityEnabled); mLockIcon.update(); } @@ -297,8 +316,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL public void onClick(View v) { if (v == mCameraImageView) { launchCamera(); - } else if (v == mPhoneImageView) { - launchPhone(); + } else if (v == mLeftAffordanceView) { + launchLeftAffordance(); } if (v == mLockIcon) { if (!mAccessibilityController.isAccessibilityEnabled()) { handleTrustCircleClick(); @@ -363,6 +382,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL @Override public void run() { mContext.startActivityAsUser(intent, UserHandle.CURRENT); + mActivityStarter.preventNextAnimation(); } }); } else { @@ -373,7 +393,35 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL } } - public void launchPhone() { + public void launchLeftAffordance() { + if (mLeftIsVoiceAssist) { + launchVoiceAssist(); + } else { + launchPhone(); + } + } + + private void launchVoiceAssist() { + Runnable runnable = new Runnable() { + @Override + public void run() { + mAssistManager.launchVoiceAssistFromKeyguard(); + mActivityStarter.preventNextAnimation(); + } + }; + if (mPhoneStatusBar.isKeyguardCurrentlySecure()) { + AsyncTask.execute(runnable); + } else { + mPhoneStatusBar.executeRunnableDismissingKeyguard(runnable, false /* dismissShade */, + false /* afterKeyguardGone */); + } + } + + private boolean canLaunchVoiceAssist() { + return mAssistManager.canVoiceAssistBeLaunchedFromKeyguard(); + } + + private void launchPhone() { final TelecomManager tm = TelecomManager.from(mContext); if (tm.isInCall()) { AsyncTask.execute(new Runnable() { @@ -397,19 +445,19 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL } } - public KeyguardAffordanceView getPhoneView() { - return mPhoneImageView; + public KeyguardAffordanceView getLeftView() { + return mLeftAffordanceView; } - public KeyguardAffordanceView getCameraView() { + public KeyguardAffordanceView getRightView() { return mCameraImageView; } - public View getPhonePreview() { - return mPhonePreview; + public View getLeftPreview() { + return mLeftPreview; } - public View getCameraPreview() { + public View getRightPreview() { return mCameraPreview; } @@ -432,23 +480,35 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL updateCameraVisibility(); } - private void inflatePreviews() { - mPhonePreview = mPreviewInflater.inflatePreview(PHONE_INTENT); + private void inflateCameraPreview() { mCameraPreview = mPreviewInflater.inflatePreview(getCameraIntent()); - if (mPhonePreview != null) { - mPreviewContainer.addView(mPhonePreview); - mPhonePreview.setVisibility(View.INVISIBLE); - } if (mCameraPreview != null) { mPreviewContainer.addView(mCameraPreview); mCameraPreview.setVisibility(View.INVISIBLE); } } + private void updateLeftPreview() { + View previewBefore = mLeftPreview; + if (previewBefore != null) { + mPreviewContainer.removeView(previewBefore); + } + if (mLeftIsVoiceAssist) { + mLeftPreview = mPreviewInflater.inflatePreviewFromService( + mAssistManager.getVoiceInteractorComponentName()); + } else { + mLeftPreview = mPreviewInflater.inflatePreview(PHONE_INTENT); + } + if (mLeftPreview != null) { + mPreviewContainer.addView(mLeftPreview); + mLeftPreview.setVisibility(View.INVISIBLE); + } + } + public void startFinishDozeAnimation() { long delay = 0; - if (mPhoneImageView.getVisibility() == View.VISIBLE) { - startFinishDozeAnimationElement(mPhoneImageView, delay); + if (mLeftAffordanceView.getVisibility() == View.VISIBLE) { + startFinishDozeAnimationElement(mLeftAffordanceView, delay); delay += DOZE_ANIMATION_STAGGER_DELAY; } startFinishDozeAnimationElement(mLockIcon, delay); @@ -543,4 +603,14 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL KeyguardIndicationController keyguardIndicationController) { mIndicationController = keyguardIndicationController; } + + public void setAssistManager(AssistManager assistManager) { + mAssistManager = assistManager; + updateLeftAffordance(); + } + + public void updateLeftAffordance() { + updateLeftAffordanceIcon(); + updateLeftPreview(); + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index a8ecc42..c3ede75 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -952,6 +952,10 @@ public class NotificationPanelView extends PanelView implements } else { mKeyguardStatusBar.setAlpha(1f); mKeyguardStatusBar.setVisibility(keyguardShowing ? View.VISIBLE : View.INVISIBLE); + if (keyguardShowing && oldState != mStatusBarState) { + mKeyguardBottomArea.updateLeftAffordance(); + mAfforanceHelper.updatePreviews(); + } } resetVerticalPanelPosition(); updateQsState(); @@ -1831,7 +1835,7 @@ public class NotificationPanelView extends PanelView implements if (start) { EventLogTags.writeSysuiLockscreenGesture( EventLogConstants.SYSUI_LOCKSCREEN_GESTURE_SWIPE_DIALER, lengthDp, velocityDp); - mKeyguardBottomArea.launchPhone(); + mKeyguardBottomArea.launchLeftAffordance(); } else { EventLogTags.writeSysuiLockscreenGesture( EventLogConstants.SYSUI_LOCKSCREEN_GESTURE_SWIPE_CAMERA, lengthDp, velocityDp); @@ -1912,15 +1916,19 @@ public class NotificationPanelView extends PanelView implements if (rightIcon) { mStatusBar.onCameraHintStarted(); } else { - mStatusBar.onPhoneHintStarted(); + if (mKeyguardBottomArea.isLeftVoiceAssist()) { + mStatusBar.onVoiceAssistHintStarted(); + } else { + mStatusBar.onPhoneHintStarted(); + } } } @Override public KeyguardAffordanceView getLeftIcon() { return getLayoutDirection() == LAYOUT_DIRECTION_RTL - ? mKeyguardBottomArea.getCameraView() - : mKeyguardBottomArea.getPhoneView(); + ? mKeyguardBottomArea.getRightView() + : mKeyguardBottomArea.getLeftView(); } @Override @@ -1931,22 +1939,22 @@ public class NotificationPanelView extends PanelView implements @Override public KeyguardAffordanceView getRightIcon() { return getLayoutDirection() == LAYOUT_DIRECTION_RTL - ? mKeyguardBottomArea.getPhoneView() - : mKeyguardBottomArea.getCameraView(); + ? mKeyguardBottomArea.getLeftView() + : mKeyguardBottomArea.getRightView(); } @Override public View getLeftPreview() { return getLayoutDirection() == LAYOUT_DIRECTION_RTL - ? mKeyguardBottomArea.getCameraPreview() - : mKeyguardBottomArea.getPhonePreview(); + ? mKeyguardBottomArea.getRightPreview() + : mKeyguardBottomArea.getLeftPreview(); } @Override public View getRightPreview() { return getLayoutDirection() == LAYOUT_DIRECTION_RTL - ? mKeyguardBottomArea.getPhonePreview() - : mKeyguardBottomArea.getCameraPreview(); + ? mKeyguardBottomArea.getLeftPreview() + : mKeyguardBottomArea.getRightPreview(); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java index f3d4c7f..d5209ea 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java @@ -80,6 +80,14 @@ public class PanelBar extends FrameLayout { } } + public void setBouncerShowing(boolean showing) { + if (mPanelHolder != null) { + mPanelHolder.setImportantForAccessibility( + showing ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS + : IMPORTANT_FOR_ACCESSIBILITY_AUTO); + } + } + public float getBarHeight() { return getMeasuredHeight(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java index 85f312c..38812ce 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java @@ -46,6 +46,7 @@ import java.io.PrintWriter; public abstract class PanelView extends FrameLayout { public static final boolean DEBUG = PanelBar.DEBUG; public static final String TAG = PanelView.class.getSimpleName(); + private final void logf(String fmt, Object... args) { Log.v(TAG, (mViewName != null ? (mViewName + ": ") : "") + String.format(fmt, args)); } @@ -77,6 +78,7 @@ public abstract class PanelView extends FrameLayout { private boolean mTouchStartedInEmptyArea; private boolean mMotionAborted; private boolean mUpwardsWhenTresholdReached; + private boolean mAnimatingOnDown; private ValueAnimator mHeightAnimator; private ObjectAnimator mPeekAnimator; @@ -459,8 +461,8 @@ public abstract class PanelView extends FrameLayout { switch (event.getActionMasked()) { case MotionEvent.ACTION_DOWN: mStatusBar.userActivity(); - if (mHeightAnimator != null && !mHintAnimationRunning || - mPeekPending || mPeekAnimator != null) { + mAnimatingOnDown = mHeightAnimator != null; + if (mAnimatingOnDown && mClosing && !mHintAnimationRunning || mPeekPending || mPeekAnimator != null) { cancelHeightAnimator(); cancelPeek(); mTouchSlopExceeded = true; @@ -501,8 +503,10 @@ public abstract class PanelView extends FrameLayout { case MotionEvent.ACTION_MOVE: final float h = y - mInitialTouchY; trackMovement(event); - if (scrolledToBottom || mTouchStartedInEmptyArea) { - if (h < -mTouchSlop && h < -Math.abs(x - mInitialTouchX)) { + if (scrolledToBottom || mTouchStartedInEmptyArea || mAnimatingOnDown) { + float hAbs = Math.abs(h); + if ((h < -mTouchSlop || (mAnimatingOnDown && hAbs > mTouchSlop)) + && hAbs > Math.abs(x - mInitialTouchX)) { cancelHeightAnimator(); startExpandMotion(x, y, true /* startTracking */, mExpandedHeight); return true; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 1c46d42..351977b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -76,6 +76,7 @@ import android.view.Display; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MotionEvent; +import android.view.ThreadedRenderer; import android.view.VelocityTracker; import android.view.View; import android.view.ViewGroup.LayoutParams; @@ -101,7 +102,7 @@ import com.android.systemui.EventLogConstants; import com.android.systemui.EventLogTags; import com.android.systemui.Prefs; import com.android.systemui.R; -import com.android.systemui.assist.AssistGestureManager; +import com.android.systemui.assist.AssistManager; import com.android.systemui.doze.DozeHost; import com.android.systemui.doze.DozeLog; import com.android.systemui.keyguard.KeyguardViewMediator; @@ -323,7 +324,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, private int mNavigationIconHints = 0; private HandlerThread mHandlerThread; - private AssistGestureManager mAssistGestureManager; + private AssistManager mAssistManager; // ensure quick settings is disabled until the current user makes it through the setup wizard private boolean mUserSetup = false; @@ -645,8 +646,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, new NavigationBarView.OnVerticalChangedListener() { @Override public void onVerticalChanged(boolean isVertical) { - if (mAssistGestureManager != null) { - mAssistGestureManager.onConfigurationChanged(); + if (mAssistManager != null) { + mAssistManager.onConfigurationChanged(); } mNotificationPanel.setQsScrimEnabled(!isVertical); } @@ -662,6 +663,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, // no window manager? good luck with that } + mAssistManager = new AssistManager(this, context); + // figure out which pixel-format to use for the status bar. mPixelFormat = PixelFormat.OPAQUE; @@ -720,6 +723,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mKeyguardBottomArea = (KeyguardBottomAreaView) mStatusBarWindow.findViewById(R.id.keyguard_bottom_area); mKeyguardBottomArea.setActivityStarter(this); + mKeyguardBottomArea.setAssistManager(mAssistManager); mKeyguardIndicationController = new KeyguardIndicationController(mContext, (KeyguardIndicationTextView) mStatusBarWindow.findViewById( R.id.keyguard_indication_text)); @@ -841,7 +845,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mBroadcastReceiver.onReceive(mContext, new Intent(pm.isScreenOn() ? Intent.ACTION_SCREEN_ON : Intent.ACTION_SCREEN_OFF)); - mAssistGestureManager = new AssistGestureManager(this, context); // receive broadcasts IntentFilter filter = new IntentFilter(); @@ -857,6 +860,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, // listen for USER_SETUP_COMPLETE setting (per-user) resetUserSetupObserver(); + // disable profiling bars, since they overlap and clutter the output on app windows + ThreadedRenderer.overrideProperty("disableProfileBars", "true"); + + // Private API call to make the shadows look better for Recents + ThreadedRenderer.overrideProperty("ambientRatio", String.valueOf(1.5f)); + return mStatusBarView; } @@ -964,7 +973,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, public void invokeAssistGesture(boolean vibrate) { mHandler.removeCallbacks(mInvokeAssist); - mAssistGestureManager.onGestureInvoked(vibrate); + mAssistManager.onGestureInvoked(vibrate); } public int getStatusBarHeight() { @@ -1044,7 +1053,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mNavigationBarView.getBackButton().setLongClickable(true); mNavigationBarView.getBackButton().setOnLongClickListener(mLongPressBackRecentsListener); mNavigationBarView.getHomeButton().setOnTouchListener(mHomeActionListener); - mAssistGestureManager.onConfigurationChanged(); + mAssistManager.onConfigurationChanged(); } // For small-screen devices (read: phones) that lack hardware navigation buttons @@ -1805,6 +1814,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, startActivityDismissingKeyguard(intent, false, dismissShade); } + @Override + public void preventNextAnimation() { + overrideActivityPendingAppTransition(true /* keyguardShowing */); + } + public void setQsExpanded(boolean expanded) { mStatusBarWindowManager.setQsExpanded(expanded); } @@ -1924,6 +1938,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, return mHeadsUpManager.isSnoozed(sbn.getPackageName()); } + public boolean isKeyguardCurrentlySecure() { + return !mUnlockMethodCache.isCurrentlyInsecure(); + } + /** * All changes to the status bar and notifications funnel through here and are batched. */ @@ -2650,6 +2668,23 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, final boolean afterKeyguardGone = PreviewInflater.wouldLaunchResolverActivity( mContext, intent, mCurrentUserId); final boolean keyguardShowing = mStatusBarKeyguardViewManager.isShowing(); + Runnable runnable = new Runnable() { + public void run() { + intent.setFlags( + Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); + mContext.startActivityAsUser( + intent, new UserHandle(UserHandle.USER_CURRENT)); + overrideActivityPendingAppTransition( + keyguardShowing && !afterKeyguardGone); + } + }; + executeRunnableDismissingKeyguard(runnable, dismissShade, afterKeyguardGone); + } + + public void executeRunnableDismissingKeyguard(final Runnable runnable, + final boolean dismissShade, + final boolean afterKeyguardGone) { + final boolean keyguardShowing = mStatusBarKeyguardViewManager.isShowing(); dismissKeyguardThenExecute(new OnDismissAction() { @Override public boolean onDismiss() { @@ -2660,12 +2695,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, ActivityManagerNative.getDefault() .keyguardWaitingForActivityDrawn(); } - intent.setFlags( - Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); - mContext.startActivityAsUser( - intent, new UserHandle(UserHandle.USER_CURRENT)); - overrideActivityPendingAppTransition( - keyguardShowing && !afterKeyguardGone); + if (runnable != null) { + runnable.run(); + } } catch (RemoteException e) { } } @@ -3019,7 +3051,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mHandlerThread = null; } mContext.unregisterReceiver(mBroadcastReceiver); - mAssistGestureManager.destroy(); + mAssistManager.destroy(); } private boolean mDemoModeAllowed; @@ -3467,6 +3499,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mKeyguardIndicationController.showTransientIndication(R.string.camera_hint); } + public void onVoiceAssistHintStarted() { + mKeyguardIndicationController.showTransientIndication(R.string.voice_hint); + } + public void onPhoneHintStarted() { mKeyguardIndicationController.showTransientIndication(R.string.phone_hint); } @@ -3579,6 +3615,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, @Override public void setBouncerShowing(boolean bouncerShowing) { super.setBouncerShowing(bouncerShowing); + mStatusBarView.setBouncerShowing(bouncerShowing); disable(mDisabledUnmodified1, mDisabledUnmodified2, true /* animate */); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileDataControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileDataControllerImpl.java index f2b2f66..a7fdadc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileDataControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileDataControllerImpl.java @@ -162,7 +162,7 @@ public class MobileDataControllerImpl implements NetworkController.MobileDataCon usage.warningLevel = DEFAULT_WARNING_LEVEL; } if (usage != null) { - usage.carrier = mNetworkController.getMobileNetworkName(); + usage.carrier = mNetworkController.getMobileDataNetworkName(); } return usage; } catch (RemoteException e) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java index c3c6b12..22bf47c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java @@ -84,6 +84,7 @@ public class MobileSignalController extends SignalController< mapIconSets(); mLastState.networkName = mCurrentState.networkName = mNetworkNameDefault; + mLastState.networkNameData = mCurrentState.networkNameData = mNetworkNameDefault; mLastState.enabled = mCurrentState.enabled = hasMobileData; mLastState.iconGroup = mCurrentState.iconGroup = mDefaultIcons; // Get initial data sim state. @@ -294,6 +295,7 @@ public class MobileSignalController extends SignalController< if (action.equals(TelephonyIntents.SPN_STRINGS_UPDATED_ACTION)) { updateNetworkName(intent.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_SPN, false), intent.getStringExtra(TelephonyIntents.EXTRA_SPN), + intent.getStringExtra(TelephonyIntents.EXTRA_DATA_SPN), intent.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_PLMN, false), intent.getStringExtra(TelephonyIntents.EXTRA_PLMN)); notifyListenersIfNecessary(); @@ -322,14 +324,18 @@ public class MobileSignalController extends SignalController< /** * Updates the network's name based on incoming spn and plmn. */ - void updateNetworkName(boolean showSpn, String spn, boolean showPlmn, String plmn) { + void updateNetworkName(boolean showSpn, String spn, String dataSpn, + boolean showPlmn, String plmn) { if (CHATTY) { - Log.d("CarrierLabel", "updateNetworkName showSpn=" + showSpn + " spn=" + spn + Log.d("CarrierLabel", "updateNetworkName showSpn=" + showSpn + + " spn=" + spn + " dataSpn=" + dataSpn + " showPlmn=" + showPlmn + " plmn=" + plmn); } StringBuilder str = new StringBuilder(); + StringBuilder strData = new StringBuilder(); if (showPlmn && plmn != null) { str.append(plmn); + strData.append(plmn); } if (showSpn && spn != null) { if (str.length() != 0) { @@ -342,6 +348,17 @@ public class MobileSignalController extends SignalController< } else { mCurrentState.networkName = mNetworkNameDefault; } + if (showSpn && dataSpn != null) { + if (strData.length() != 0) { + strData.append(mNetworkNameSeparator); + } + strData.append(dataSpn); + } + if (strData.length() != 0) { + mCurrentState.networkNameData = strData.toString(); + } else { + mCurrentState.networkNameData = mNetworkNameDefault; + } } /** @@ -492,6 +509,7 @@ public class MobileSignalController extends SignalController< static class MobileState extends SignalController.State { String networkName; + String networkNameData; boolean dataSim; boolean dataConnected; boolean isEmergency; @@ -505,6 +523,7 @@ public class MobileSignalController extends SignalController< MobileState state = (MobileState) s; dataSim = state.dataSim; networkName = state.networkName; + networkNameData = state.networkNameData; dataConnected = state.dataConnected; inetForNetwork = state.inetForNetwork; isEmergency = state.isEmergency; @@ -518,6 +537,7 @@ public class MobileSignalController extends SignalController< builder.append(','); builder.append("dataSim=").append(dataSim).append(','); builder.append("networkName=").append(networkName).append(','); + builder.append("networkNameData=").append(networkNameData).append(','); builder.append("dataConnected=").append(dataConnected).append(','); builder.append("inetForNetwork=").append(inetForNetwork).append(','); builder.append("isEmergency=").append(isEmergency).append(','); @@ -529,6 +549,7 @@ public class MobileSignalController extends SignalController< public boolean equals(Object o) { return super.equals(o) && Objects.equals(((MobileState) o).networkName, networkName) + && Objects.equals(((MobileState) o).networkNameData, networkNameData) && ((MobileState) o).dataSim == dataSim && ((MobileState) o).dataConnected == dataConnected && ((MobileState) o).isEmergency == isEmergency diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java index 6d88535..df133e4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java @@ -246,9 +246,9 @@ public class NetworkControllerImpl extends BroadcastReceiver return mDefaultSignalController; } - public String getMobileNetworkName() { + public String getMobileDataNetworkName() { MobileSignalController controller = getDataController(); - return controller != null ? controller.getState().networkName : ""; + return controller != null ? controller.getState().networkNameData : ""; } public boolean isEmergencyOnly() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/PreviewInflater.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/PreviewInflater.java index 5d89e2f..4269c19 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/PreviewInflater.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/PreviewInflater.java @@ -21,6 +21,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; +import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; @@ -50,6 +51,15 @@ public class PreviewInflater { public View inflatePreview(Intent intent) { WidgetInfo info = getWidgetInfo(intent); + return inflatePreview(info); + } + + public View inflatePreviewFromService(ComponentName componentName) { + WidgetInfo info = getWidgetInfoFromService(componentName); + return inflatePreview(info); + } + + private KeyguardPreviewContainer inflatePreview(WidgetInfo info) { if (info == null) { return null; } @@ -77,8 +87,36 @@ public class PreviewInflater { return widgetView; } - private WidgetInfo getWidgetInfo(Intent intent) { + private WidgetInfo getWidgetInfoFromService(ComponentName componentName) { + PackageManager packageManager = mContext.getPackageManager(); + // Look for the preview specified in the service meta-data + try { + Bundle metaData = packageManager.getServiceInfo( + componentName, PackageManager.GET_META_DATA).metaData; + return getWidgetInfoFromMetaData(componentName.getPackageName(), metaData); + } catch (PackageManager.NameNotFoundException e) { + Log.w(TAG, "Failed to load preview; " + componentName.flattenToShortString() + + " not found", e); + } + return null; + } + + private WidgetInfo getWidgetInfoFromMetaData(String contextPackage, + Bundle metaData) { + if (metaData == null) { + return null; + } + int layoutId = metaData.getInt(META_DATA_KEYGUARD_LAYOUT); + if (layoutId == 0) { + return null; + } WidgetInfo info = new WidgetInfo(); + info.contextPackage = contextPackage; + info.layoutId = layoutId; + return info; + } + + private WidgetInfo getWidgetInfo(Intent intent) { PackageManager packageManager = mContext.getPackageManager(); final List<ResolveInfo> appList = packageManager.queryIntentActivitiesAsUser( intent, PackageManager.MATCH_DEFAULT_ONLY, KeyguardUpdateMonitor.getCurrentUser()); @@ -94,16 +132,8 @@ public class PreviewInflater { if (resolved == null || resolved.activityInfo == null) { return null; } - if (resolved.activityInfo.metaData == null || resolved.activityInfo.metaData.isEmpty()) { - return null; - } - int layoutId = resolved.activityInfo.metaData.getInt(META_DATA_KEYGUARD_LAYOUT); - if (layoutId == 0) { - return null; - } - info.contextPackage = resolved.activityInfo.packageName; - info.layoutId = layoutId; - return info; + return getWidgetInfoFromMetaData(resolved.activityInfo.packageName, + resolved.activityInfo.metaData); } public static boolean wouldLaunchResolverActivity(Context ctx, Intent intent, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java index 202063a..de28ac7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java @@ -582,7 +582,7 @@ public class StackScrollAlgorithm { return row.getIntrinsicHeight(); } else if (child instanceof ExpandableView) { ExpandableView expandableView = (ExpandableView) child; - return expandableView.getActualHeight(); + return expandableView.getIntrinsicHeight(); } return child == null? mCollapsedSize : child.getHeight(); } diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java index 9434036..7115897 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java @@ -16,6 +16,9 @@ package com.android.systemui.volume; +import static android.accessibilityservice.AccessibilityServiceInfo.FEEDBACK_ALL_MASK; + +import android.accessibilityservice.AccessibilityServiceInfo; import android.animation.LayoutTransition; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; @@ -32,6 +35,7 @@ import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.media.AudioManager; import android.media.AudioSystem; +import android.os.Debug; import android.os.Handler; import android.os.Looper; import android.os.Message; @@ -43,6 +47,8 @@ import android.util.SparseBooleanArray; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; +import android.view.View.AccessibilityDelegate; +import android.view.View.OnAttachStateChangeListener; import android.view.View.OnClickListener; import android.view.View.OnLayoutChangeListener; import android.view.View.OnTouchListener; @@ -50,6 +56,9 @@ import android.view.ViewGroup; import android.view.ViewGroup.MarginLayoutParams; import android.view.Window; import android.view.WindowManager; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityManager; +import android.view.accessibility.AccessibilityManager.AccessibilityStateChangeListener; import android.view.animation.DecelerateInterpolator; import android.widget.ImageButton; import android.widget.LinearLayout; @@ -97,6 +106,7 @@ public class VolumeDialog { private final ZenFooter mZenFooter; private final LayoutTransition mLayoutTransition; private final Object mSafetyWarningLock = new Object(); + private final Accessibility mAccessibility = new Accessibility(); private boolean mShowing; private boolean mExpanded; @@ -174,6 +184,8 @@ public class VolumeDialog { mZenFooter = (ZenFooter) mDialog.findViewById(R.id.volume_zen_footer); mZenFooter.init(zenModeController); + mAccessibility.init(); + controller.addCallback(mControllerCallbackH, mHandler); controller.getState(); } @@ -409,10 +421,13 @@ public class VolumeDialog { protected void rescheduleTimeoutH() { mHandler.removeMessages(H.DISMISS); - final int timeout = computeTimeoutH(); - if (D.BUG) Log.d(TAG, "rescheduleTimeout " + timeout); - mHandler.sendMessageDelayed(mHandler - .obtainMessage(H.DISMISS, Events.DISMISS_REASON_TIMEOUT, 0), timeout); + int timeout = -1; + if (!mAccessibility.mFeedbackEnabled) { + timeout = computeTimeoutH(); + mHandler.sendMessageDelayed(mHandler + .obtainMessage(H.DISMISS, Events.DISMISS_REASON_TIMEOUT, 0), timeout); + } + if (D.BUG) Log.d(TAG, "rescheduleTimeout " + timeout + " " + Debug.getCaller()); mController.userActivity(); } @@ -475,6 +490,8 @@ public class VolumeDialog { if (res == mExpandButtonRes) return; mExpandButtonRes = res; mExpandButton.setImageResource(res); + mExpandButton.setContentDescription(mContext.getString(mExpanded ? + R.string.accessibility_volume_collapse : R.string.accessibility_volume_expand)); } private boolean isVisibleH(VolumeRow row, boolean isActive) { @@ -632,6 +649,7 @@ public class VolumeDialog { : (iconRes == R.drawable.ic_volume_media_bt || iconRes == row.iconRes) ? Events.ICON_STATE_UNMUTE : Events.ICON_STATE_UNKNOWN; + row.icon.setContentDescription(ss.name); // update slider updateVolumeRowSliderH(row, zenMuted); @@ -931,6 +949,56 @@ public class VolumeDialog { } } + private final class Accessibility { + private AccessibilityManager mMgr; + private boolean mFeedbackEnabled; + + public void init() { + mMgr = (AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE); + mDialogView.addOnAttachStateChangeListener(new OnAttachStateChangeListener() { + @Override + public void onViewDetachedFromWindow(View v) { + // noop + } + + @Override + public void onViewAttachedToWindow(View v) { + updateFeedbackEnabled(); + } + }); + mDialogView.setAccessibilityDelegate(new AccessibilityDelegate() { + @Override + public boolean onRequestSendAccessibilityEvent(ViewGroup host, View child, + AccessibilityEvent event) { + rescheduleTimeoutH(); + return super.onRequestSendAccessibilityEvent(host, child, event); + } + }); + mMgr.addAccessibilityStateChangeListener(new AccessibilityStateChangeListener() { + @Override + public void onAccessibilityStateChanged(boolean enabled) { + updateFeedbackEnabled(); + } + }); + updateFeedbackEnabled(); + } + + private void updateFeedbackEnabled() { + mFeedbackEnabled = computeFeedbackEnabled(); + } + + private boolean computeFeedbackEnabled() { + final List<AccessibilityServiceInfo> services = + mMgr.getEnabledAccessibilityServiceList(FEEDBACK_ALL_MASK); + for (AccessibilityServiceInfo asi : services) { + if ((asi.feedbackType & FEEDBACK_ALL_MASK) != 0) { + return true; + } + } + return false; + } + } + private static class VolumeRow { private View view; private View space; |
