diff options
Diffstat (limited to 'packages/SystemUI')
24 files changed, 424 insertions, 87 deletions
diff --git a/packages/SystemUI/res/drawable/managed_profile_toast_background.xml b/packages/SystemUI/res/drawable/managed_profile_toast_background.xml deleted file mode 100644 index 5c77b9a..0000000 --- a/packages/SystemUI/res/drawable/managed_profile_toast_background.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -Copyright (C) 2015 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <corners android:radius="2dp" /> - <solid android:color="@color/managed_profile_toast_background" /> -</shape> diff --git a/packages/SystemUI/res/interpolator/assist_disclosure_trace.xml b/packages/SystemUI/res/interpolator/assist_disclosure_trace.xml new file mode 100644 index 0000000..6b5cd37 --- /dev/null +++ b/packages/SystemUI/res/interpolator/assist_disclosure_trace.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2015 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> + +<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android" + android:controlX1="0.6" + android:controlY1="0" + android:controlX2="0.7" + android:controlY2="1"/>
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/keyguard_bottom_area.xml b/packages/SystemUI/res/layout/keyguard_bottom_area.xml index 48af565..1488ad6 100644 --- a/packages/SystemUI/res/layout/keyguard_bottom_area.xml +++ b/packages/SystemUI/res/layout/keyguard_bottom_area.xml @@ -68,7 +68,6 @@ android:layout_height="@dimen/keyguard_affordance_height" android:layout_gravity="bottom|center_horizontal" android:src="@drawable/ic_lock_24dp" - android:scaleType="center" - android:contentDescription="@string/accessibility_unlock_button" /> + android:scaleType="center" /> </com.android.systemui.statusbar.phone.KeyguardBottomAreaView> diff --git a/packages/SystemUI/res/layout/managed_profile_toast.xml b/packages/SystemUI/res/layout/managed_profile_toast.xml deleted file mode 100644 index 5a01ca7..0000000 --- a/packages/SystemUI/res/layout/managed_profile_toast.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2015 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:paddingTop="16dp" - android:paddingBottom="16dp" - android:paddingLeft="32dp" - android:paddingRight="32dp" - android:background="@drawable/managed_profile_toast_background"> - <ImageView - android:layout_width="32dp" - android:layout_height="32dp" - android:layout_gravity="center_horizontal" - android:layout_marginBottom="16dp" - android:src="@drawable/stat_sys_managed_profile_status"/> - <TextView android:text="@string/managed_profile_foreground_toast" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="@android:color/white" - android:textSize="14sp" - android:layout_gravity="center_horizontal" /> -</LinearLayout> diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index 9a96939..0dcbe88 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -143,6 +143,4 @@ <color name="volume_icon_color">#ffffffff</color> <color name="volume_settings_icon_color">#7fffffff</color> <color name="volume_slider_inactive">#FFB0BEC5</color><!-- blue grey 200 --> - - <color name="managed_profile_toast_background">#E5000000</color><!-- 90% black --> </resources> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index b0e71f9..869b03a 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -575,4 +575,13 @@ <!-- Standard image button size for volume dialog buttons --> <dimen name="volume_button_size">48dp</dimen> + + <!-- Padding between icon and text for managed profile toast --> + <dimen name="managed_profile_toast_padding">4dp</dimen> + + <!-- Thickness of the assist disclosure beams --> + <dimen name="assist_disclosure_thickness">4dp</dimen> + + <!-- Thickness of the shadows of the assist disclosure beams --> + <dimen name="assist_disclosure_shadow_thickness">1.5dp</dimen> </resources> diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 5c9f866..d32ce55 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -215,6 +215,10 @@ <string name="accessibility_voice_assist_button">Voice Assist</string> <!-- Content description of the unlock button for accessibility (not shown on the screen). [CHAR LIMIT=NONE] --> <string name="accessibility_unlock_button">Unlock</string> + <!-- Content description of the unlock button when fingerpint is on (not shown on the screen). [CHAR LIMIT=NONE] --> + <string name="accessibility_unlock_button_fingerprint">Unlock button, waiting for fingerprint</string> + <!-- Accessibility action of the unlock button when fingerpint is on (not shown on the screen). [CHAR LIMIT=NONE] --> + <string name="accessibility_unlock_without_fingerprint">Unlock without using your fingerprint</string> <!-- Click action label for accessibility for the unlock button. [CHAR LIMIT=NONE] --> <string name="unlock_label">unlock</string> <!-- Click action label for accessibility for the phone button. [CHAR LIMIT=NONE] --> diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java b/packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java new file mode 100644 index 0000000..585f9ba --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java @@ -0,0 +1,261 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +package com.android.systemui.assist; + +import com.android.systemui.R; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.AnimatorSet; +import android.animation.ValueAnimator; +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.PixelFormat; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffXfermode; +import android.os.Handler; +import android.view.View; +import android.view.WindowManager; +import android.view.animation.AnimationUtils; + +/** + * Visually discloses that contextual data was provided to an assistant. + */ +public class AssistDisclosure { + private final Context mContext; + private final WindowManager mWm; + private final Handler mHandler; + + private AssistDisclosureView mView; + private boolean mViewAdded; + + public AssistDisclosure(Context context, Handler handler) { + mContext = context; + mHandler = handler; + mWm = mContext.getSystemService(WindowManager.class); + } + + public void postShow() { + mHandler.removeCallbacks(mShowRunnable); + mHandler.post(mShowRunnable); + } + + private void show() { + if (mView == null) { + mView = new AssistDisclosureView(mContext); + } + if (!mViewAdded) { + WindowManager.LayoutParams lp = new WindowManager.LayoutParams( + WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY, + WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE + | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED + | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN + | WindowManager.LayoutParams.FLAG_FULLSCREEN + | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED, + PixelFormat.TRANSLUCENT); + lp.setTitle("AssistDisclosure"); + + mWm.addView(mView, lp); + mViewAdded = true; + } + } + + private void hide() { + if (mViewAdded) { + mWm.removeView(mView); + mViewAdded = false; + } + } + + private Runnable mShowRunnable = new Runnable() { + @Override + public void run() { + show(); + } + }; + + private class AssistDisclosureView extends View + implements ValueAnimator.AnimatorUpdateListener { + + public static final int TRACING_ANIMATION_DURATION = 600; + public static final int ALPHA_IN_ANIMATION_DURATION = 450; + public static final int ALPHA_OUT_ANIMATION_DURATION = 400; + + private float mThickness; + private float mShadowThickness; + private final Paint mPaint = new Paint(); + private final Paint mShadowPaint = new Paint(); + + private final ValueAnimator mTracingAnimator; + private final ValueAnimator mAlphaOutAnimator; + private final ValueAnimator mAlphaInAnimator; + private final AnimatorSet mAnimator; + + private float mTracingProgress = 0; + private int mAlpha = 0; + + public AssistDisclosureView(Context context) { + super(context); + + mTracingAnimator = ValueAnimator.ofFloat(0, 1).setDuration(TRACING_ANIMATION_DURATION); + mTracingAnimator.addUpdateListener(this); + mTracingAnimator.setInterpolator(AnimationUtils.loadInterpolator(mContext, + R.interpolator.assist_disclosure_trace)); + mAlphaInAnimator = ValueAnimator.ofInt(0, 255).setDuration(ALPHA_IN_ANIMATION_DURATION); + mAlphaInAnimator.addUpdateListener(this); + mAlphaInAnimator.setInterpolator(AnimationUtils.loadInterpolator(mContext, + android.R.interpolator.fast_out_slow_in)); + mAlphaOutAnimator = ValueAnimator.ofInt(255, 0).setDuration( + ALPHA_OUT_ANIMATION_DURATION); + mAlphaOutAnimator.addUpdateListener(this); + mAlphaOutAnimator.setInterpolator(AnimationUtils.loadInterpolator(mContext, + android.R.interpolator.fast_out_linear_in)); + mAnimator = new AnimatorSet(); + mAnimator.play(mAlphaInAnimator).with(mTracingAnimator); + mAnimator.play(mAlphaInAnimator).before(mAlphaOutAnimator); + mAnimator.addListener(new AnimatorListenerAdapter() { + boolean mCancelled; + + @Override + public void onAnimationStart(Animator animation) { + mCancelled = false; + } + + @Override + public void onAnimationCancel(Animator animation) { + mCancelled = true; + } + + @Override + public void onAnimationEnd(Animator animation) { + if (!mCancelled) { + hide(); + } + } + }); + + PorterDuffXfermode srcMode = new PorterDuffXfermode(PorterDuff.Mode.SRC); + mPaint.setColor(Color.WHITE); + mPaint.setXfermode(srcMode); + mShadowPaint.setColor(Color.DKGRAY); + mShadowPaint.setXfermode(srcMode); + + mThickness = getResources().getDimension(R.dimen.assist_disclosure_thickness); + mShadowThickness = getResources().getDimension( + R.dimen.assist_disclosure_shadow_thickness); + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + + startAnimation(); + } + + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + + mAnimator.cancel(); + + mTracingProgress = 0; + mAlpha = 0; + } + + private void startAnimation() { + mAnimator.cancel(); + mAnimator.start(); + } + + @Override + protected void onDraw(Canvas canvas) { + mPaint.setAlpha(mAlpha); + mShadowPaint.setAlpha(mAlpha / 4); + + drawGeometry(canvas, mShadowPaint, mShadowThickness); + drawGeometry(canvas, mPaint, 0); + } + + private void drawGeometry(Canvas canvas, Paint paint, float padding) { + final int width = getWidth(); + final int height = getHeight(); + float thickness = mThickness; + final float pixelProgress = mTracingProgress * (width + height - 2 * thickness); + + float bottomProgress = Math.min(pixelProgress, width / 2f); + if (bottomProgress > 0) { + drawBeam(canvas, + width / 2f - bottomProgress, + height - thickness, + width / 2f + bottomProgress, + height, paint, padding); + } + + float sideProgress = Math.min(pixelProgress - bottomProgress, height - thickness); + if (sideProgress > 0) { + drawBeam(canvas, + 0, + (height - thickness) - sideProgress, + thickness, + height - thickness, paint, padding); + drawBeam(canvas, + width - thickness, + (height - thickness) - sideProgress, + width, + height - thickness, paint, padding); + } + + float topProgress = Math.min(pixelProgress - bottomProgress - sideProgress, + width / 2 - thickness); + if (sideProgress > 0 && topProgress > 0) { + drawBeam(canvas, + thickness, + 0, + thickness + topProgress, + thickness, paint, padding); + drawBeam(canvas, + (width - thickness) - topProgress, + 0, + width - thickness, + thickness, paint, padding); + } + } + + private void drawBeam(Canvas canvas, float left, float top, float right, float bottom, + Paint paint, float padding) { + canvas.drawRect(left - padding, + top - padding, + right + padding, + bottom + padding, + paint); + } + + @Override + public void onAnimationUpdate(ValueAnimator animation) { + if (animation == mAlphaOutAnimator) { + mAlpha = (int) mAlphaOutAnimator.getAnimatedValue(); + } else if (animation == mAlphaInAnimator) { + mAlpha = (int) mAlphaInAnimator.getAnimatedValue(); + } else if (animation == mTracingAnimator) { + mTracingProgress = (float) mTracingAnimator.getAnimatedValue(); + } + invalidate(); + } + } +} diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java index 445ecb6..674356b 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java @@ -55,6 +55,8 @@ public class AssistManager { private final Context mContext; private final WindowManager mWindowManager; + private final AssistDisclosure mAssistDisclosure; + private AssistOrbContainer mView; private final PhoneStatusBar mBar; private final AssistUtils mAssistUtils; @@ -100,6 +102,7 @@ public class AssistManager { Settings.Secure.getUriFor(Settings.Secure.ASSISTANT), false, mAssistSettingsObserver); mAssistSettingsObserver.onChange(false); + mAssistDisclosure = new AssistDisclosure(context, new Handler()); } public void onConfigurationChanged() { @@ -187,8 +190,11 @@ public class AssistManager { mBar.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL | CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL); + boolean structureEnabled = Settings.Secure.getIntForUser(mContext.getContentResolver(), + Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1, UserHandle.USER_CURRENT) != 0; + final Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) - .getAssistIntent(mContext, true, UserHandle.USER_CURRENT); + .getAssistIntent(mContext, structureEnabled, UserHandle.USER_CURRENT); if (intent == null) { return; } @@ -196,6 +202,10 @@ public class AssistManager { intent.setComponent(mAssistComponent); } + if (structureEnabled) { + showDisclosure(); + } + try { final ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext, R.anim.search_launch_enter, R.anim.search_launch_exit); @@ -297,4 +307,8 @@ public class AssistManager { pw.println("AssistManager state:"); pw.print(" mAssistComponent="); pw.println(mAssistComponent); } + + public void showDisclosure() { + mAssistDisclosure.postShow(); + } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index c06b34f..80761d8 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -62,6 +62,7 @@ import com.android.internal.telephony.IccCardConstants; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardConstants; import com.android.keyguard.KeyguardDisplayManager; +import com.android.keyguard.KeyguardSecurityView; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.keyguard.ViewMediatorCallback; @@ -526,6 +527,17 @@ public class KeyguardViewMediator extends SystemUI { public boolean isScreenOn() { return mDeviceInteractive; } + + @Override + public int getBouncerPromptReason() { + int currentUser = ActivityManager.getCurrentUser(); + if ((mUpdateMonitor.getUserTrustIsManaged(currentUser) + || mUpdateMonitor.isUnlockWithFingerPrintPossible(currentUser)) + && !mTrustManager.hasUserAuthenticatedSinceBoot(currentUser)) { + return KeyguardSecurityView.PROMPT_REASON_RESTART; + } + return KeyguardSecurityView.PROMPT_REASON_NONE; + } }; public void userActivity() { diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index 9761cd1..4b1453d 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -390,7 +390,7 @@ public class QSPanel extends ViewGroup { mDetailSettingsButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { - mHost.startSettingsActivity(settingsIntent); + mHost.startActivityDismissingKeyguard(settingsIntent); } }); diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java index 72bb136..38fade2 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java @@ -306,7 +306,7 @@ public abstract class QSTile<TState extends State> implements Listenable { } public interface Host { - void startSettingsActivity(Intent intent); + void startActivityDismissingKeyguard(Intent intent); void warn(String message, Throwable t); void collapsePanels(); Looper getLooper(); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java index a9e8b38..07406b9 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java @@ -82,7 +82,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> { if (mDataController.isMobileDataSupported()) { showDetail(true); } else { - mHost.startSettingsActivity(CELLULAR_SETTINGS); + mHost.startActivityDismissingKeyguard(CELLULAR_SETTINGS); } } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java index f97f519..1b74eb6 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java @@ -263,7 +263,7 @@ public class DndTile extends QSTile<QSTile.BooleanState> { private final ZenModePanel.Callback mZenModePanelCallback = new ZenModePanel.Callback() { @Override public void onPrioritySettings() { - mHost.startSettingsActivity(ZEN_PRIORITY_SETTINGS); + mHost.startActivityDismissingKeyguard(ZEN_PRIORITY_SETTINGS); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java index 19f4df6..f7f7acb 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java @@ -96,7 +96,11 @@ public class IntentTile extends QSTile<QSTile.State> { private void sendIntent(String type, PendingIntent pi, String uri) { try { if (pi != null) { - pi.send(); + if (pi.isActivity()) { + getHost().startActivityDismissingKeyguard(pi.getIntent()); + } else { + pi.send(); + } } else if (uri != null) { final Intent intent = Intent.parseUri(uri, Intent.URI_INTENT_SCHEME); mContext.sendBroadcastAsUser(intent, new UserHandle(mCurrentUserId)); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java index 9bc5b75..c33ef7c 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java @@ -104,7 +104,7 @@ public class WifiTile extends QSTile<QSTile.SignalState> { @Override protected void handleSecondaryClick() { if (!mWifiController.canConfigWifi()) { - mHost.startSettingsActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)); + mHost.startActivityDismissingKeyguard(new Intent(Settings.ACTION_WIFI_SETTINGS)); return; } if (!mState.enabled) { @@ -290,7 +290,7 @@ public class WifiTile extends QSTile<QSTile.SignalState> { @Override public void onSettingsActivityTriggered(Intent settingsIntent) { - mHost.startSettingsActivity(settingsIntent); + mHost.startActivityDismissingKeyguard(settingsIntent); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index a496548..295fdc8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -393,13 +393,16 @@ public abstract class BaseStatusBar extends SystemUI implements if (recentTask != null && recentTask.size() > 0) { UserInfo user = mUserManager.getUserInfo(recentTask.get(0).userId); if (user != null && user.isManagedProfile()) { - LayoutInflater inflater = (LayoutInflater) mContext.getSystemService( - Context.LAYOUT_INFLATER_SERVICE); - View layout = inflater.inflate(R.layout.managed_profile_toast, null); - Toast toast = new Toast(mContext); - toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0); - toast.setDuration(Toast.LENGTH_SHORT); - toast.setView(layout); + Toast toast = Toast.makeText(mContext, + R.string.managed_profile_foreground_toast, + Toast.LENGTH_SHORT); + TextView text = (TextView) toast.getView().findViewById( + android.R.id.message); + text.setCompoundDrawablesRelativeWithIntrinsicBounds( + R.drawable.stat_sys_managed_profile_status, 0, 0, 0); + int paddingPx = mContext.getResources().getDimensionPixelSize( + R.dimen.managed_profile_toast_padding); + text.setCompoundDrawablePadding(paddingPx); toast.show(); } } @@ -2098,4 +2101,11 @@ public abstract class BaseStatusBar extends SystemUI implements } return mStatusBarKeyguardViewManager.isSecure(); } + + @Override + public void showAssistDisclosure() { + if (mAssistManager != null) { + mAssistManager.showDisclosure(); + } + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java index 80fdd28..0deff08 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java @@ -61,6 +61,7 @@ public class CommandQueue extends IStatusBar.Stub { private static final int MSG_APP_TRANSITION_PENDING = 19 << MSG_SHIFT; private static final int MSG_APP_TRANSITION_CANCELLED = 20 << MSG_SHIFT; private static final int MSG_APP_TRANSITION_STARTING = 21 << MSG_SHIFT; + private static final int MSG_ASSIST_DISCLOSURE = 22 << MSG_SHIFT; public static final int FLAG_EXCLUDE_NONE = 0; public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0; @@ -104,6 +105,7 @@ public class CommandQueue extends IStatusBar.Stub { public void appTransitionPending(); public void appTransitionCancelled(); public void appTransitionStarting(long startTime, long duration); + public void showAssistDisclosure(); } public CommandQueue(Callbacks callbacks, StatusBarIconList list) { @@ -274,6 +276,13 @@ public class CommandQueue extends IStatusBar.Stub { } } + public void showAssistDisclosure() { + synchronized (mList) { + mHandler.removeMessages(MSG_ASSIST_DISCLOSURE); + mHandler.obtainMessage(MSG_ASSIST_DISCLOSURE).sendToTarget(); + } + } + private final class H extends Handler { public void handleMessage(Message msg) { final int what = msg.what & MSG_MASK; @@ -366,6 +375,9 @@ public class CommandQueue extends IStatusBar.Stub { Pair<Long, Long> data = (Pair<Long, Long>) msg.obj; mCallbacks.appTransitionStarting(data.first, data.second); break; + case MSG_ASSIST_DISCLOSURE: + mCallbacks.showAssistDisclosure(); + break; } } } 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 3258a9f..815e123 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -614,6 +614,13 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL } }; + private final Runnable mHideTransientIndicationRunnable = new Runnable() { + @Override + public void run() { + mIndicationController.hideTransientIndication(); + } + }; + private final KeyguardUpdateMonitorCallback mUpdateMonitorCallback = new KeyguardUpdateMonitorCallback() { @Override @@ -657,6 +664,10 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL @Override public void onFingerprintError(int msgId, String errString) { // TODO: Go to bouncer if this is "too many attempts" (lockout) error. + mIndicationController.showTransientIndication(errString, + getResources().getColor(R.color.system_warning_color, null)); + removeCallbacks(mHideTransientIndicationRunnable); + postDelayed(mHideTransientIndicationRunnable, 5000); } }; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java index 3737d05..a3bb129 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -26,6 +26,7 @@ import android.view.accessibility.AccessibilityEvent; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardHostView; +import com.android.keyguard.KeyguardSecurityView; import com.android.keyguard.R; import com.android.keyguard.ViewMediatorCallback; @@ -46,6 +47,7 @@ public class KeyguardBouncer { private ViewGroup mRoot; private boolean mShowingSoon; private Choreographer mChoreographer = Choreographer.getInstance(); + private int mBouncerPromptReason; public KeyguardBouncer(Context context, ViewMediatorCallback callback, LockPatternUtils lockPatternUtils, StatusBarWindowManager windowManager, @@ -68,6 +70,8 @@ public class KeyguardBouncer { return; } + mBouncerPromptReason = mCallback.getBouncerPromptReason(); + // Try to dismiss the Keyguard. If no security pattern is set, this will dismiss the whole // Keyguard. If we need to authenticate, show the bouncer. if (!mKeyguardView.dismiss()) { @@ -84,12 +88,24 @@ public class KeyguardBouncer { public void run() { mRoot.setVisibility(View.VISIBLE); mKeyguardView.onResume(); + showPromptReason(mBouncerPromptReason); mKeyguardView.startAppearAnimation(); mShowingSoon = false; mKeyguardView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); } }; + /** + * Show a string explaining why the security view needs to be solved. + * + * @param reason a flag indicating which string should be shown, see + * {@link KeyguardSecurityView#PROMPT_REASON_NONE} + * and {@link KeyguardSecurityView#PROMPT_REASON_RESTART} + */ + public void showPromptReason(int reason) { + mKeyguardView.showPromptReason(reason); + } + private void cancelShowRunnable() { mChoreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION, mShowRunnable, null); mShowingSoon = false; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java index 2063b26..f5fdf48 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java @@ -16,14 +16,13 @@ package com.android.systemui.statusbar.phone; -import android.annotation.NonNull; -import android.annotation.Nullable; import android.content.Context; import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.InsetDrawable; import android.util.AttributeSet; import android.view.View; +import android.view.accessibility.AccessibilityNodeInfo; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.R; @@ -54,6 +53,7 @@ public class LockIcon extends KeyguardAffordanceView { private final TrustDrawable mTrustDrawable; private final UnlockMethodCache mUnlockMethodCache; private AccessibilityController mAccessibilityController; + private boolean mHasFingerPrintIcon; public LockIcon(Context context, AttributeSet attrs) { super(context, attrs); @@ -128,6 +128,11 @@ public class LockIcon extends KeyguardAffordanceView { setRestingAlpha( anyFingerprintIcon ? 1f : KeyguardAffordanceHelper.SWIPE_RESTING_ALPHA_AMOUNT); setImageDrawable(icon); + String contentDescription = getResources().getString(anyFingerprintIcon + ? R.string.accessibility_unlock_button_fingerprint + : R.string.accessibility_unlock_button); + setContentDescription(contentDescription); + mHasFingerPrintIcon = anyFingerprintIcon; if (animation != null) { // If we play the draw on animation, delay it by one frame when the screen is @@ -167,6 +172,20 @@ public class LockIcon extends KeyguardAffordanceView { setFocusable(mAccessibilityController.isAccessibilityEnabled()); } + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + if (mHasFingerPrintIcon) { + // Avoid that the button description is also spoken + info.setClassName(LockIcon.class.getName()); + AccessibilityNodeInfo.AccessibilityAction unlock + = new AccessibilityNodeInfo.AccessibilityAction( + AccessibilityNodeInfo.ACTION_CLICK, + getContext().getString(R.string.accessibility_unlock_without_fingerprint)); + info.addAction(unlock); + } + } + public void setAccessibilityController(AccessibilityController accessibilityController) { mAccessibilityController = accessibilityController; } 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 cd90d27..ade40e5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -3101,16 +3101,16 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, || (mDisabled1 & StatusBarManager.DISABLE_SEARCH) != 0; } - public void postStartSettingsActivity(final Intent intent, int delay) { + public void postStartActivityDismissingKeyguard(final Intent intent, int delay) { mHandler.postDelayed(new Runnable() { @Override public void run() { - handleStartSettingsActivity(intent, true /*onlyProvisioned*/); + handleStartActivityDismissingKeyguard(intent, true /*onlyProvisioned*/); } }, delay); } - private void handleStartSettingsActivity(Intent intent, boolean onlyProvisioned) { + private void handleStartActivityDismissingKeyguard(Intent intent, boolean onlyProvisioned) { startActivityDismissingKeyguard(intent, onlyProvisioned, true /* dismissShade */); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java index 25a93dd..12434ac 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java @@ -129,8 +129,8 @@ public class QSTileHost implements QSTile.Host, Tunable { } @Override - public void startSettingsActivity(final Intent intent) { - mStatusBar.postStartSettingsActivity(intent, 0); + public void startActivityDismissingKeyguard(final Intent intent) { + mStatusBar.postStartActivityDismissingKeyguard(intent, 0); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java index 3cc9297..daa84ad 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java @@ -154,6 +154,12 @@ public class BluetoothControllerImpl implements BluetoothController, BluetoothCa } private void updateConnected() { + // Make sure our connection state is up to date. + int state = mLocalBluetoothManager.getBluetoothAdapter().getConnectionState(); + if (state != mConnectionState) { + mConnectionState = state; + mHandler.sendEmptyMessage(H.MSG_STATE_CHANGED); + } if (mLastDevice != null && mLastDevice.isConnected()) { // Our current device is still valid. return; @@ -203,9 +209,9 @@ public class BluetoothControllerImpl implements BluetoothController, BluetoothCa @Override public void onConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state) { - mConnectionState = state; mLastDevice = cachedDevice; updateConnected(); + mConnectionState = state; mHandler.sendEmptyMessage(H.MSG_STATE_CHANGED); } |