diff options
Diffstat (limited to 'packages/SystemUI')
29 files changed, 340 insertions, 173 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/EventLogConstants.java b/packages/SystemUI/src/com/android/systemui/EventLogConstants.java new file mode 100644 index 0000000..c8af2d4 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/EventLogConstants.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2014 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; + +/** + * Constants to be passed as sysui_* eventlog parameters. + */ +public class EventLogConstants { + /** The user swiped up on the lockscreen, unlocking the device. */ + public static final int SYSUI_LOCKSCREEN_GESTURE_SWIPE_UP_UNLOCK = 1; + /** The user swiped down on the lockscreen, going to the full shade. */ + public static final int SYSUI_LOCKSCREEN_GESTURE_SWIPE_DOWN_FULL_SHADE = 2; + /** The user tapped in an empty area, causing the unlock hint to be shown. */ + public static final int SYSUI_LOCKSCREEN_GESTURE_TAP_UNLOCK_HINT = 3; + /** The user swiped inward on the camera icon, launching the camera. */ + public static final int SYSUI_LOCKSCREEN_GESTURE_SWIPE_CAMERA = 4; + /** The user swiped inward on the dialer icon, launching the dialer. */ + public static final int SYSUI_LOCKSCREEN_GESTURE_SWIPE_DIALER = 5; + /** The user tapped the lock, locking the device. */ + public static final int SYSUI_LOCKSCREEN_GESTURE_TAP_LOCK = 6; + /** The user tapped a notification, needs to tap again to launch. */ + public static final int SYSUI_LOCKSCREEN_GESTURE_TAP_NOTIFICATION_ACTIVATE = 7; +} diff --git a/packages/SystemUI/src/com/android/systemui/EventLogTags.logtags b/packages/SystemUI/src/com/android/systemui/EventLogTags.logtags index 191cba5..d2ce94b 100644 --- a/packages/SystemUI/src/com/android/systemui/EventLogTags.logtags +++ b/packages/SystemUI/src/com/android/systemui/EventLogTags.logtags @@ -9,7 +9,14 @@ option java_package com.android.systemui; 36001 sysui_heads_up_status (key|3),(visible|1) 36002 sysui_fullscreen_notification (key|3) 36003 sysui_heads_up_escalation (key|3) -36004 sysui_status_bar_state (state|1) +# sysui_status_bar_state: Logged whenever the status bar / keyguard state changes +## state: 0: SHADE, 1: KEYGUARD, 2: SHADE_LOCKED +## keyguardShowing: 1: Keyguard shown to the user (or keyguardOccluded) +## keyguardOccluded: 1: Keyguard active, but another activity is occluding it +## bouncerShowing: 1: Bouncer currently shown to the user +## secure: 1: The user has set up a secure unlock method (PIN, password, etc.) +## currentlyInsecure: 1: No secure unlock method set up (!secure), or trusted environment (TrustManager) +36004 sysui_status_bar_state (state|1),(keyguardShowing|1),(keyguardOccluded|1),(bouncerShowing|1),(secure|1),(currentlyInsecure|1) # --------------------------- # PhoneStatusBarView.java @@ -20,6 +27,15 @@ option java_package com.android.systemui; # NotificationPanelView.java # --------------------------- 36020 sysui_notificationpanel_touch (type|1),(x|1),(y|1) +## type: 1: SWIPE_UP_UNLOCK Swiped up to dismiss the lockscreen. +## 2: SWIPE_DOWN_FULL_SHADE Swiped down to enter full shade. +## 3: TAP_UNLOCK_HINT Tapped in empty area, causes unlock hint. +## 4: SWIPE_CAMERA Swiped the camera icon, launches. +## 5: SWIPE_DIALER Swiped the dialer icon, launches. +## 6: TAP_LOCK Tapped the (unlocked) lock icon, locks the device. +## 7: TAP_NOTIFICATION_ACTIVATE Tapped a lockscreen notification, causes "tap again" hint. +## Note: Second tap logged as notification_clicked. +36021 sysui_lockscreen_gesture (type|1),(lengthDp|1),(velocityDp|1) # --------------------------- # SettingsPanelView.java diff --git a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java index 0516768..7c725b3 100644 --- a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java +++ b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java @@ -105,10 +105,6 @@ public class ImageWallpaper extends WallpaperService { static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098; static final int EGL_OPENGL_ES2_BIT = 4; - // TODO: Not currently used, keeping around until we know we don't need it - @SuppressWarnings({"UnusedDeclaration"}) - private WallpaperObserver mReceiver; - Bitmap mBackground; int mBackgroundWidth = -1, mBackgroundHeight = -1; int mLastSurfaceWidth = -1, mLastSurfaceHeight = -1; @@ -151,22 +147,6 @@ public class ImageWallpaper extends WallpaperService { private static final int TRIANGLE_VERTICES_DATA_POS_OFFSET = 0; private static final int TRIANGLE_VERTICES_DATA_UV_OFFSET = 3; - class WallpaperObserver extends BroadcastReceiver { - @Override - public void onReceive(Context context, Intent intent) { - if (DEBUG) { - Log.d(TAG, "onReceive"); - } - - mLastSurfaceWidth = mLastSurfaceHeight = -1; - mBackground = null; - mBackgroundWidth = -1; - mBackgroundHeight = -1; - mRedrawNeeded = true; - drawFrame(); - } - } - public DrawableEngine() { super(); setFixedSizeAllowed(true); @@ -194,12 +174,6 @@ public class ImageWallpaper extends WallpaperService { super.onCreate(surfaceHolder); - // TODO: Don't need this currently because the wallpaper service - // will restart the image wallpaper whenever the image changes. - //IntentFilter filter = new IntentFilter(Intent.ACTION_WALLPAPER_CHANGED); - //mReceiver = new WallpaperObserver(); - //registerReceiver(mReceiver, filter, null, mHandler); - updateSurfaceSize(surfaceHolder); setOffsetNotificationsEnabled(false); @@ -208,9 +182,6 @@ public class ImageWallpaper extends WallpaperService { @Override public void onDestroy() { super.onDestroy(); - if (mReceiver != null) { - unregisterReceiver(mReceiver); - } mBackground = null; mWallpaperManager.forgetLoadedWallpaper(); } @@ -562,7 +533,7 @@ public class ImageWallpaper extends WallpaperService { boolean status = mEgl.eglSwapBuffers(mEglDisplay, mEglSurface); checkEglError(); - finishGL(); + finishGL(texture, program); return status; } @@ -615,21 +586,18 @@ public class ImageWallpaper extends WallpaperService { int program = glCreateProgram(); glAttachShader(program, vertexShader); - checkGlError(); - glAttachShader(program, fragmentShader); - checkGlError(); - glLinkProgram(program); checkGlError(); + glDeleteShader(vertexShader); + glDeleteShader(fragmentShader); + int[] status = new int[1]; glGetProgramiv(program, GL_LINK_STATUS, status, 0); if (status[0] != GL_TRUE) { String error = glGetProgramInfoLog(program); Log.d(GL_LOG_TAG, "Error while linking program:\n" + error); - glDeleteShader(vertexShader); - glDeleteShader(fragmentShader); glDeleteProgram(program); return 0; } @@ -672,7 +640,11 @@ public class ImageWallpaper extends WallpaperService { } } - private void finishGL() { + private void finishGL(int texture, int program) { + int[] textures = new int[1]; + textures[0] = texture; + glDeleteTextures(1, textures, 0); + glDeleteProgram(program); mEgl.eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); mEgl.eglDestroySurface(mEglDisplay, mEglSurface); mEgl.eglDestroyContext(mEglDisplay, mEglContext); diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSDualTileLabel.java b/packages/SystemUI/src/com/android/systemui/qs/QSDualTileLabel.java index a9fdc86..67cfc59 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSDualTileLabel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSDualTileLabel.java @@ -100,9 +100,6 @@ public class QSDualTileLabel extends LinearLayout { mFirstLineCaret.setImageDrawable(d); if (d != null) { final int h = d.getIntrinsicHeight(); - final LayoutParams lp = (LayoutParams) mSecondLine.getLayoutParams(); - lp.topMargin = h * 4 / 5; - mSecondLine.setLayoutParams(lp); mFirstLine.setMinHeight(h); mFirstLine.setPadding(mHorizontalPaddingPx, 0, 0, 0); } 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 f2ebcf6..30f92b9 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java @@ -97,9 +97,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> { state.icon = ResourceIcon.get(iconId); state.isOverlayIconWide = cb.isDataTypeIconWide; state.autoMirrorDrawable = !cb.noSim; - state.overlayIconId = cb.enabled && (cb.dataTypeIconId > 0) && !cb.wifiConnected - ? cb.dataTypeIconId - : 0; + state.overlayIconId = cb.enabled && (cb.dataTypeIconId > 0) ? cb.dataTypeIconId : 0; state.filter = iconId != R.drawable.ic_qs_no_sim; state.activityIn = cb.enabled && cb.activityIn; state.activityOut = cb.enabled && cb.activityOut; @@ -184,6 +182,11 @@ public class CellularTile extends QSTile<QSTile.SignalState> { // Make sure signal gets cleared out when no sims. mInfo.mobileSignalIconId = 0; mInfo.dataTypeIconId = 0; + // Show a No SIMs description to avoid emergency calls message. + mInfo.enabled = true; + mInfo.enabledDesc = mContext.getString( + R.string.keyguard_missing_sim_message_short); + mInfo.signalContentDescription = mInfo.enabledDesc; } refreshState(mInfo); } 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 a920624..e09024b 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java @@ -30,6 +30,7 @@ import com.android.systemui.qs.QSDetailItems.Item; import com.android.systemui.qs.QSTile; import com.android.systemui.qs.QSTileView; import com.android.systemui.qs.SignalTileView; +import com.android.systemui.statusbar.phone.QSTileHost; import com.android.systemui.statusbar.policy.NetworkController; import com.android.systemui.statusbar.policy.NetworkController.AccessPointController; import com.android.systemui.statusbar.policy.NetworkController.AccessPointController.AccessPoint; @@ -290,6 +291,11 @@ public class WifiTile extends QSTile<QSTile.SignalState> { } @Override + public void onSettingsActivityTriggered(Intent settingsIntent) { + mHost.startSettingsActivity(settingsIntent); + } + + @Override public void onDetailItemClick(Item item) { if (item == null || item.tag == null) return; final AccessPoint ap = (AccessPoint) item.tag; diff --git a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java index 10618e0..910a57e 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java +++ b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java @@ -86,8 +86,8 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta final static int sMinToggleDelay = 350; final static String sToggleRecentsAction = "com.android.systemui.recents.SHOW_RECENTS"; - final static String sRecentsPackage = "com.android.systemui"; - final static String sRecentsActivity = "com.android.systemui.recents.RecentsActivity"; + public final static String sRecentsPackage = "com.android.systemui"; + public final static String sRecentsActivity = "com.android.systemui.recents.RecentsActivity"; /** * An implementation of ITaskStackListener, that allows us to listen for changes to the system @@ -111,10 +111,11 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta public void run() { RecentsConfiguration config = RecentsConfiguration.getInstance(); if (config.svelteLevel == RecentsConfiguration.SVELTE_NONE) { - ActivityManager.RunningTaskInfo runningTaskInfo = getTopMostTask(); + RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); + SystemServicesProxy ssp = loader.getSystemServicesProxy(); + ActivityManager.RunningTaskInfo runningTaskInfo = ssp.getTopMostTask(); // Load the next task only if we aren't svelte - RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); RecentsTaskLoadPlan plan = loader.createLoadPlan(mContext); loader.preloadTasks(plan, true /* isTopTaskHome */); RecentsTaskLoadPlan.Options launchOpts = new RecentsTaskLoadPlan.Options(); @@ -272,8 +273,8 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta } void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) { if (mBootCompleted) { - ActivityManager.RunningTaskInfo topTask = getTopMostTask(); - if (topTask != null && isRecentsTopMost(topTask, null)) { + ActivityManager.RunningTaskInfo topTask = mSystemServicesProxy.getTopMostTask(); + if (topTask != null && mSystemServicesProxy.isRecentsTopMost(topTask, null)) { // Notify recents to hide itself Intent intent = createLocalBroadcastIntent(mContext, ACTION_HIDE_RECENTS_ACTIVITY); intent.putExtra(EXTRA_TRIGGERED_FROM_ALT_TAB, triggeredFromAltTab); @@ -336,7 +337,7 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta // Return early if there are no tasks if (stack.getTaskCount() == 0) return; - ActivityManager.RunningTaskInfo runningTask = getTopMostTask(); + ActivityManager.RunningTaskInfo runningTask = mSystemServicesProxy.getTopMostTask(); // Return early if there is no running task (can't determine affiliated tasks in this case) if (runningTask == null) return; // Return early if the running task is in the home stack (optimization) @@ -480,38 +481,6 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta } } - /** Gets the top task. */ - ActivityManager.RunningTaskInfo getTopMostTask() { - SystemServicesProxy ssp = mSystemServicesProxy; - List<ActivityManager.RunningTaskInfo> tasks = ssp.getRunningTasks(1); - if (!tasks.isEmpty()) { - return tasks.get(0); - } - return null; - } - - /** Returns whether the recents is currently running */ - boolean isRecentsTopMost(ActivityManager.RunningTaskInfo topTask, AtomicBoolean isHomeTopMost) { - SystemServicesProxy ssp = mSystemServicesProxy; - if (topTask != null) { - ComponentName topActivity = topTask.topActivity; - - // Check if the front most activity is recents - if (topActivity.getPackageName().equals(sRecentsPackage) && - topActivity.getClassName().equals(sRecentsActivity)) { - if (isHomeTopMost != null) { - isHomeTopMost.set(false); - } - return true; - } - - if (isHomeTopMost != null) { - isHomeTopMost.set(ssp.isInHomeStack(topTask.id)); - } - } - return false; - } - /** Toggles the recents activity */ void toggleRecentsActivity() { // If the user has toggled it too quickly, then just eat up the event here (it's better than @@ -523,9 +492,9 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta // If Recents is the front most activity, then we should just communicate with it directly // to launch the first task or dismiss itself - ActivityManager.RunningTaskInfo topTask = getTopMostTask(); + ActivityManager.RunningTaskInfo topTask = mSystemServicesProxy.getTopMostTask(); AtomicBoolean isTopTaskHome = new AtomicBoolean(true); - if (topTask != null && isRecentsTopMost(topTask, isTopTaskHome)) { + if (topTask != null && mSystemServicesProxy.isRecentsTopMost(topTask, isTopTaskHome)) { // Notify recents to toggle itself Intent intent = createLocalBroadcastIntent(mContext, ACTION_TOGGLE_RECENTS_ACTIVITY); mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT); @@ -540,9 +509,9 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta /** Starts the recents activity if it is not already running */ void startRecentsActivity() { // Check if the top task is in the home stack, and start the recents activity - ActivityManager.RunningTaskInfo topTask = getTopMostTask(); + ActivityManager.RunningTaskInfo topTask = mSystemServicesProxy.getTopMostTask(); AtomicBoolean isTopTaskHome = new AtomicBoolean(true); - if (topTask == null || !isRecentsTopMost(topTask, isTopTaskHome)) { + if (topTask == null || !mSystemServicesProxy.isRecentsTopMost(topTask, isTopTaskHome)) { startRecentsActivity(topTask, isTopTaskHome.get()); } } @@ -642,12 +611,13 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta /** Starts the recents activity */ void startRecentsActivity(ActivityManager.RunningTaskInfo topTask, boolean isTopTaskHome) { + RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); + RecentsConfiguration.reinitialize(mContext, mSystemServicesProxy); + if (sInstanceLoadPlan == null) { // Create a new load plan if onPreloadRecents() was never triggered - RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); sInstanceLoadPlan = loader.createLoadPlan(mContext); } - RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); loader.preloadTasks(sInstanceLoadPlan, isTopTaskHome); TaskStack stack = sInstanceLoadPlan.getTaskStack(); diff --git a/packages/SystemUI/src/com/android/systemui/recents/Constants.java b/packages/SystemUI/src/com/android/systemui/recents/Constants.java index 4c76af7..0a1718d 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/Constants.java +++ b/packages/SystemUI/src/com/android/systemui/recents/Constants.java @@ -65,7 +65,8 @@ public class Constants { } public static class TaskStackView { - public static final int TaskStackOverscrollRange = 150; + public static final int TaskStackMinOverscrollRange = 32; + public static final int TaskStackMaxOverscrollRange = 128; public static final int FilterStartDelay = 25; } } diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java index ee631f5..cb1baeb 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java @@ -65,7 +65,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView DebugOverlayView.DebugOverlayViewCallbacks { RecentsConfiguration mConfig; - boolean mVisible; long mLastTabKeyEventTime; // Top level views @@ -315,7 +314,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView /** Dismisses recents if we are already visible and the intent is to toggle the recents view */ boolean dismissRecentsToFocusedTaskOrHome(boolean checkFilteredStackState) { - if (mVisible) { + SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy(); + if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) { // If we currently have filtered stacks, then unfilter those first if (checkFilteredStackState && mRecentsView.unfilterFilteredStacks()) return true; @@ -349,7 +349,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView /** Dismisses Recents directly to Home if we currently aren't transitioning. */ boolean dismissRecentsToHome(boolean animated) { - if (mVisible) { + SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy(); + if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) { // Return to Home dismissRecentsToHomeRaw(animated); return true; @@ -361,12 +362,11 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - // For the non-primary user, ensure that the SystemSericesProxy is initialized + // For the non-primary user, ensure that the SystemServicesProxy and configuration is + // initialized RecentsTaskLoader.initialize(this); - - // Initialize the loader and the configuration - mConfig = RecentsConfiguration.reinitialize(this, - RecentsTaskLoader.getInstance().getSystemServicesProxy()); + SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy(); + mConfig = RecentsConfiguration.reinitialize(this, ssp); // Initialize the widget host (the host id is static and does not change) mAppWidgetHost = new RecentsAppWidgetHost(this, Constants.Values.App.AppWidgetHostId); @@ -421,9 +421,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView super.onNewIntent(intent); setIntent(intent); - // Reinitialize the configuration - RecentsConfiguration.reinitialize(this, RecentsTaskLoader.getInstance().getSystemServicesProxy()); - // Clear any debug rects if (mDebugOverlay != null) { mDebugOverlay.clear(); @@ -433,7 +430,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView @Override protected void onStart() { super.onStart(); - mVisible = true; RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); SystemServicesProxy ssp = loader.getSystemServicesProxy(); AlternateRecentsComponent.notifyVisibilityChanged(this, ssp, true); @@ -450,12 +446,17 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView // Update the recent tasks updateRecentsTasks(getIntent()); + + // If this is a new instance from a configuration change, then we have to manually trigger + // the enter animation state + if (mConfig.launchedHasConfigurationChanged) { + onEnterAnimationTriggered(); + } } @Override protected void onStop() { super.onStop(); - mVisible = false; RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); SystemServicesProxy ssp = loader.getSystemServicesProxy(); AlternateRecentsComponent.notifyVisibilityChanged(this, ssp, false); diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java index 542f21c..90b099c 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java +++ b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java @@ -59,6 +59,7 @@ import android.view.SurfaceControl; import android.view.WindowManager; import android.view.accessibility.AccessibilityManager; import com.android.systemui.R; +import com.android.systemui.recents.AlternateRecentsComponent; import com.android.systemui.recents.Constants; import java.io.IOException; @@ -66,6 +67,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Random; +import java.util.concurrent.atomic.AtomicBoolean; /** * Acts as a shim around the real system services that we need to access data from, and provides @@ -217,6 +219,37 @@ public class SystemServicesProxy { return mAm.getRunningTasks(numTasks); } + /** Returns the top task. */ + public ActivityManager.RunningTaskInfo getTopMostTask() { + List<ActivityManager.RunningTaskInfo> tasks = getRunningTasks(1); + if (!tasks.isEmpty()) { + return tasks.get(0); + } + return null; + } + + /** Returns whether the recents is currently running */ + public boolean isRecentsTopMost(ActivityManager.RunningTaskInfo topTask, + AtomicBoolean isHomeTopMost) { + if (topTask != null) { + ComponentName topActivity = topTask.topActivity; + + // Check if the front most activity is recents + if (topActivity.getPackageName().equals(AlternateRecentsComponent.sRecentsPackage) && + topActivity.getClassName().equals(AlternateRecentsComponent.sRecentsActivity)) { + if (isHomeTopMost != null) { + isHomeTopMost.set(false); + } + return true; + } + + if (isHomeTopMost != null) { + isHomeTopMost.set(isInHomeStack(topTask.id)); + } + } + return false; + } + /** Returns whether the specified task is in the home stack */ public boolean isInHomeStack(int taskId) { if (mAm == null) return false; diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java index 255d642..81f0cef 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java +++ b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java @@ -252,6 +252,8 @@ public class TaskStack { if (group.getTaskCount() == 0) { removeGroup(group); } + // Update the lock-to-app state + t.lockToThisTask = false; if (mCb != null) { // Notify that a task has been removed mCb.onStackTaskRemoved(this, t, null); @@ -480,4 +482,4 @@ public class TaskStack { } return str; } -}
\ No newline at end of file +} diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java index ee79242..427ffe5 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java @@ -542,7 +542,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV loader.deleteTaskData(t, false); // Remove the old task from activity manager - RecentsTaskLoader.getInstance().getSystemServicesProxy().removeTask(t.key.id); + loader.getSystemServicesProxy().removeTask(t.key.id); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java index c59f82c..59e38f4 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java @@ -273,20 +273,21 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback { break; } case MotionEvent.ACTION_UP: { - final VelocityTracker velocityTracker = mVelocityTracker; - velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity); - int velocity = (int) velocityTracker.getYVelocity(mActivePointerId); + mVelocityTracker.computeCurrentVelocity(1000, mMaximumVelocity); + int velocity = (int) mVelocityTracker.getYVelocity(mActivePointerId); if (mIsScrolling && (Math.abs(velocity) > mMinimumVelocity)) { - int overscrollRange = (int) (Math.min(1f, - Math.abs((float) velocity / mMaximumVelocity)) * - Constants.Values.TaskStackView.TaskStackOverscrollRange); - // Fling scroll - mScroller.mScroller.fling(0, mScroller.progressToScrollRange(mScroller.getStackScroll()), + float overscrollRangePct = Math.abs((float) velocity / mMaximumVelocity); + int overscrollRange = (int) (Math.min(1f, overscrollRangePct) * + (Constants.Values.TaskStackView.TaskStackMaxOverscrollRange - + Constants.Values.TaskStackView.TaskStackMinOverscrollRange)); + mScroller.mScroller.fling(0, + mScroller.progressToScrollRange(mScroller.getStackScroll()), 0, velocity, 0, 0, mScroller.progressToScrollRange(mSv.mLayoutAlgorithm.mMinScrollP), mScroller.progressToScrollRange(mSv.mLayoutAlgorithm.mMaxScrollP), - 0, overscrollRange); + 0, Constants.Values.TaskStackView.TaskStackMinOverscrollRange + + overscrollRange); // Invalidate to kick off computeScroll mSv.invalidate(); } else if (mScroller.isScrollOutOfBounds()) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 2b6ac26..3392d8e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -1549,7 +1549,11 @@ public abstract class BaseStatusBar extends SystemUI implements dismissKeyguardThenExecute(new OnDismissAction() { public boolean onDismiss() { if (mIsHeadsUp) { - mHeadsUpNotificationView.clear(); + // Release the HUN notification to the shade. + // + // In most cases, when FLAG_AUTO_CANCEL is set, the notification will + // become canceled shortly by NoMan, but we can't assume that. + mHeadsUpNotificationView.releaseAndClose(); } new Thread() { @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java index df475d5..c9f0260 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java @@ -126,7 +126,8 @@ public class DragDownHelper implements Gefingerpoken { } return true; case MotionEvent.ACTION_UP: - if (mDraggedFarEnough && mDragDownCallback.onDraggedDown(mStartingChild)) { + if (mDraggedFarEnough && mDragDownCallback.onDraggedDown(mStartingChild, + (int) (y - mInitialTouchY))) { if (mStartingChild == null) { mDragDownCallback.setEmptyDragAmount(0f); } @@ -221,7 +222,7 @@ public class DragDownHelper implements Gefingerpoken { /** * @return true if the interaction is accepted, false if it should be cancelled */ - boolean onDraggedDown(View startingChild); + boolean onDraggedDown(View startingChild, int dragLengthY); void onDragDownReset(); void onThresholdReached(); void onTouchSlopExceeded(); 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 58a2d41..3b8fccc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java @@ -317,7 +317,7 @@ public class KeyguardAffordanceHelper { animator.addListener(mFlingEndListener); if (!snapBack) { startFinishingCircleAnimation(vel * 0.375f, mAnimationEndRunnable); - mCallback.onAnimationToSideStarted(mTranslation < 0); + mCallback.onAnimationToSideStarted(mTranslation < 0, mTranslation, vel); } else { reset(true); } @@ -461,7 +461,7 @@ public class KeyguardAffordanceHelper { * * @param rightPage Is the page animated to the right page? */ - void onAnimationToSideStarted(boolean rightPage); + void onAnimationToSideStarted(boolean rightPage, float translation, float vel); /** * Notifies the callback the animation to a side page has ended. 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 503f588..acf7af9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -47,6 +47,8 @@ import android.widget.TextView; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; +import com.android.systemui.EventLogConstants; +import com.android.systemui.EventLogTags; import com.android.systemui.R; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.KeyguardAffordanceView; @@ -320,6 +322,9 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL } private void handleTrustCircleClick() { + EventLogTags.writeSysuiLockscreenGesture( + EventLogConstants.SYSUI_LOCKSCREEN_GESTURE_TAP_LOCK, 0 /* lengthDp - N/A */, + 0 /* velocityDp - N/A */); mIndicationController.showTransientIndication( R.string.keyguard_indication_trust_disabled); mLockPatternUtils.requireCredentialEntry(mLockPatternUtils.getCurrentUser()); @@ -388,7 +393,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL // TODO: Real icon for facelock. int iconRes = mUnlockMethodCache.isFaceUnlockRunning() ? com.android.internal.R.drawable.ic_account_circle - : mUnlockMethodCache.isMethodInsecure() ? R.drawable.ic_lock_open_24dp + : mUnlockMethodCache.isCurrentlyInsecure() ? R.drawable.ic_lock_open_24dp : R.drawable.ic_lock_24dp; if (mLastUnlockIconRes != iconRes) { Drawable icon = mContext.getDrawable(iconRes); @@ -438,7 +443,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL } @Override - public void onMethodSecureChanged(boolean methodSecure) { + public void onUnlockMethodStateChanged() { updateLockIcon(); updateCameraVisibility(); } 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 3292f9b..5bc1321 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -212,6 +212,9 @@ public class KeyguardBouncer { return false; } + /** + * WARNING: This method might cause Binder calls. + */ public boolean isSecure() { return mKeyguardView == null || mKeyguardView.getSecurityMode() != SecurityMode.None; } 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 1b00e59..e30a5c2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -39,6 +39,8 @@ import android.widget.FrameLayout; import android.widget.TextView; import com.android.keyguard.KeyguardStatusView; +import com.android.systemui.EventLogTags; +import com.android.systemui.EventLogConstants; import com.android.systemui.R; import com.android.systemui.qs.QSContainer; import com.android.systemui.qs.QSPanel; @@ -1670,13 +1672,20 @@ public class NotificationPanelView extends PanelView implements } @Override - public void onAnimationToSideStarted(boolean rightPage) { + public void onAnimationToSideStarted(boolean rightPage, float translation, float vel) { boolean start = getLayoutDirection() == LAYOUT_DIRECTION_RTL ? rightPage : !rightPage; mIsLaunchTransitionRunning = true; mLaunchAnimationEndRunnable = null; + float displayDensity = mStatusBar.getDisplayDensity(); + int lengthDp = Math.abs((int) (translation / displayDensity)); + int velocityDp = Math.abs((int) (vel / displayDensity)); if (start) { + EventLogTags.writeSysuiLockscreenGesture( + EventLogConstants.SYSUI_LOCKSCREEN_GESTURE_SWIPE_DIALER, lengthDp, velocityDp); mKeyguardBottomArea.launchPhone(); } else { + EventLogTags.writeSysuiLockscreenGesture( + EventLogConstants.SYSUI_LOCKSCREEN_GESTURE_SWIPE_CAMERA, lengthDp, velocityDp); mSecureCameraLaunchManager.startSecureCameraLaunch(); } mStatusBar.startLaunchTransitionTimeout(); 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 a044743..d86ccee 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java @@ -32,6 +32,8 @@ import android.view.animation.AnimationUtils; import android.view.animation.Interpolator; import android.widget.FrameLayout; +import com.android.systemui.EventLogConstants; +import com.android.systemui.EventLogTags; import com.android.systemui.R; import com.android.systemui.doze.DozeLog; import com.android.systemui.statusbar.FlingAnimationUtils; @@ -338,6 +340,15 @@ public abstract class PanelView extends FrameLayout { DozeLog.traceFling(expand, mTouchAboveFalsingThreshold, mStatusBar.isFalsingThresholdNeeded(), mStatusBar.isScreenOnComingFromTouch()); + // Log collapse gesture if on lock screen. + if (!expand && mStatusBar.getBarState() == StatusBarState.KEYGUARD) { + float displayDensity = mStatusBar.getDisplayDensity(); + int heightDp = (int) Math.abs((y - mInitialTouchY) / displayDensity); + int velocityDp = (int) Math.abs(vel / displayDensity); + EventLogTags.writeSysuiLockscreenGesture( + EventLogConstants.SYSUI_LOCKSCREEN_GESTURE_SWIPE_UP_UNLOCK, + heightDp, velocityDp); + } fling(vel, expand); mUpdateFlingOnLayout = expand && mPanelClosedOnDown && !mHasLayoutedSinceDown; if (mUpdateFlingOnLayout) { @@ -941,6 +952,9 @@ public abstract class PanelView extends FrameLayout { switch (mStatusBar.getBarState()) { case StatusBarState.KEYGUARD: if (!mDozingOnDown) { + EventLogTags.writeSysuiLockscreenGesture( + EventLogConstants.SYSUI_LOCKSCREEN_GESTURE_TAP_UNLOCK_HINT, + 0 /* lengthDp - N/A */, 0 /* velocityDp - N/A */); startUnlockHintAnimation(); } 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 d6647af..140c3ba 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -121,6 +121,7 @@ import com.android.keyguard.KeyguardHostView.OnDismissAction; import com.android.keyguard.ViewMediatorCallback; import com.android.systemui.BatteryMeterView; import com.android.systemui.DemoMode; +import com.android.systemui.EventLogConstants; import com.android.systemui.EventLogTags; import com.android.systemui.FontSizeUtils; import com.android.systemui.R; @@ -147,6 +148,7 @@ import com.android.systemui.statusbar.SignalClusterView; import com.android.systemui.statusbar.SpeedBumpView; import com.android.systemui.statusbar.StatusBarIconView; import com.android.systemui.statusbar.StatusBarState; +import com.android.systemui.statusbar.phone.UnlockMethodCache.OnUnlockMethodChangedListener; import com.android.systemui.statusbar.policy.AccessibilityController; import com.android.systemui.statusbar.policy.BatteryController; import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback; @@ -183,7 +185,7 @@ import java.util.List; import java.util.Map; public class PhoneStatusBar extends BaseStatusBar implements DemoMode, - DragDownHelper.DragDownCallback, ActivityStarter { + DragDownHelper.DragDownCallback, ActivityStarter, OnUnlockMethodChangedListener { static final String TAG = "PhoneStatusBar"; public static final boolean DEBUG = BaseStatusBar.DEBUG; public static final boolean SPEW = false; @@ -493,6 +495,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, private boolean mLaunchTransitionFadingAway; private ExpandableNotificationRow mDraggedDownRow; + // Fingerprint (as computed by getLoggingFingerprint() of the last logged state. + private int mLastLoggedStateFingerprint; + private static final int VISIBLE_LOCATIONS = ViewState.LOCATION_FIRST_CARD | ViewState.LOCATION_TOP_STACK_PEEKING | ViewState.LOCATION_MAIN_AREA @@ -603,6 +608,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mHeadsUpObserver); } mUnlockMethodCache = UnlockMethodCache.getInstance(mContext); + mUnlockMethodCache.addListener(this); startKeyguard(); mDozeServiceHost = new DozeServiceHost(); @@ -2159,8 +2165,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, public boolean isFalsingThresholdNeeded() { boolean onKeyguard = getBarState() == StatusBarState.KEYGUARD; - boolean isMethodInsecure = mUnlockMethodCache.isMethodInsecure(); - return onKeyguard && (isMethodInsecure || mDozing || mScreenOnComingFromTouch); + boolean isCurrentlyInsecure = mUnlockMethodCache.isCurrentlyInsecure(); + return onKeyguard && (isCurrentlyInsecure || mDozing || mScreenOnComingFromTouch); } public boolean isDozing() { @@ -2177,6 +2183,18 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } /** + * To be called when there's a state change in StatusBarKeyguardViewManager. + */ + public void onKeyguardViewManagerStatesUpdated() { + logStateToEventlog(); + } + + @Override // UnlockMethodCache.OnUnlockMethodChangedListener + public void onUnlockMethodStateChanged() { + logStateToEventlog(); + } + + /** * All changes to the status bar and notifications funnel through here and are batched. */ private class H extends BaseStatusBar.H { @@ -3061,6 +3079,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } } + float getDisplayDensity() { + return mDisplayMetrics.density; + } + public void startActivityDismissingKeyguard(final Intent intent, boolean onlyProvisioned, final boolean dismissShade) { if (onlyProvisioned && !isDeviceProvisioned()) return; @@ -3348,6 +3370,47 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } } + // State logging + + private void logStateToEventlog() { + boolean isShowing = mStatusBarKeyguardViewManager.isShowing(); + boolean isOccluded = mStatusBarKeyguardViewManager.isOccluded(); + boolean isBouncerShowing = mStatusBarKeyguardViewManager.isBouncerShowing(); + boolean isSecure = mUnlockMethodCache.isMethodSecure(); + boolean isCurrentlyInsecure = mUnlockMethodCache.isCurrentlyInsecure(); + int stateFingerprint = getLoggingFingerprint(mState, + isShowing, + isOccluded, + isBouncerShowing, + isSecure, + isCurrentlyInsecure); + if (stateFingerprint != mLastLoggedStateFingerprint) { + EventLogTags.writeSysuiStatusBarState(mState, + isShowing ? 1 : 0, + isOccluded ? 1 : 0, + isBouncerShowing ? 1 : 0, + isSecure ? 1 : 0, + isCurrentlyInsecure ? 1 : 0); + mLastLoggedStateFingerprint = stateFingerprint; + } + } + + /** + * Returns a fingerprint of fields logged to eventlog + */ + private static int getLoggingFingerprint(int statusBarState, boolean keyguardShowing, + boolean keyguardOccluded, boolean bouncerShowing, boolean secure, + boolean currentlyInsecure) { + // Reserve 8 bits for statusBarState. We'll never go higher than + // that, right? Riiiight. + return (statusBarState & 0xFF) + | ((keyguardShowing ? 1 : 0) << 8) + | ((keyguardOccluded ? 1 : 0) << 9) + | ((bouncerShowing ? 1 : 0) << 10) + | ((secure ? 1 : 0) << 11) + | ((currentlyInsecure ? 1 : 0) << 12); + } + // // tracing // @@ -3824,6 +3887,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, @Override public void onActivated(ActivatableNotificationView view) { + EventLogTags.writeSysuiLockscreenGesture( + EventLogConstants.SYSUI_LOCKSCREEN_GESTURE_TAP_NOTIFICATION_ACTIVATE, + 0 /* lengthDp - N/A */, 0 /* velocityDp - N/A */); mKeyguardIndicationController.showTransientIndication(R.string.notification_tap_again); ActivatableNotificationView previousView = mStackScroller.getActivatedChild(); if (previousView != null) { @@ -3836,19 +3902,15 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, * @param state The {@link StatusBarState} to set. */ public void setBarState(int state) { - if (state != mState) { - EventLogTags.writeSysuiStatusBarState(state); - - // If we're visible and switched to SHADE_LOCKED (the user dragged - // down on the lockscreen), clear notification LED, vibration, - // ringing. - // Other transitions are covered in handleVisibleToUserChanged(). - if (mVisible && state == StatusBarState.SHADE_LOCKED) { - try { - mBarService.clearNotificationEffects(); - } catch (RemoteException e) { - // Ignore. - } + // If we're visible and switched to SHADE_LOCKED (the user dragged + // down on the lockscreen), clear notification LED, vibration, + // ringing. + // Other transitions are covered in handleVisibleToUserChanged(). + if (state != mState && mVisible && state == StatusBarState.SHADE_LOCKED) { + try { + mBarService.clearNotificationEffects(); + } catch (RemoteException e) { + // Ignore. } } mState = state; @@ -3890,7 +3952,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, public void onTrackingStopped(boolean expand) { if (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) { - if (!expand && !mUnlockMethodCache.isMethodInsecure()) { + if (!expand && !mUnlockMethodCache.isCurrentlyInsecure()) { showBouncer(); } } @@ -3908,8 +3970,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, // ---------------------- DragDownHelper.OnDragDownListener ------------------------------------ @Override - public boolean onDraggedDown(View startingChild) { + public boolean onDraggedDown(View startingChild, int dragLengthY) { if (hasActiveNotifications()) { + EventLogTags.writeSysuiLockscreenGesture( + EventLogConstants.SYSUI_LOCKSCREEN_GESTURE_SWIPE_DOWN_FULL_SHADE, + (int) (dragLengthY / mDisplayMetrics.density), + 0 /* velocityDp - N/A */); // We have notifications, go to locked shade. goToLockedShade(startingChild); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java index d6bd94b..0e8a794 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -88,7 +88,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener { public void onTrackingStarted() { mExpanding = true; - mDarkenWhileDragging = !mUnlockMethodCache.isMethodInsecure(); + mDarkenWhileDragging = !mUnlockMethodCache.isCurrentlyInsecure(); } public void onExpandingFinished() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SecureCameraLaunchManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SecureCameraLaunchManager.java index 3f5cf3f..4a43c47 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SecureCameraLaunchManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SecureCameraLaunchManager.java @@ -175,6 +175,7 @@ public class SecureCameraLaunchManager { public void run() { Intent intent = new Intent(); intent.setAction(CLOSE_CAMERA_ACTION_NAME); + intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); mContext.sendBroadcast(intent); } }); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index f4edab5..1724e70 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -303,6 +303,9 @@ public class StatusBarKeyguardViewManager { } } + /** + * WARNING: This method might cause Binder calls. + */ public boolean isSecure() { return mBouncer.isSecure(); } @@ -396,6 +399,8 @@ public class StatusBarKeyguardViewManager { mLastOccluded = occluded; mLastBouncerShowing = bouncerShowing; mLastBouncerDismissible = bouncerDismissible; + + mPhoneStatusBar.onKeyguardViewManagerStatesUpdated(); } public boolean onMenuPressed() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java index e5eef9d..5ef345b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java @@ -36,7 +36,10 @@ public class UnlockMethodCache { private final LockPatternUtils mLockPatternUtils; private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; private final ArrayList<OnUnlockMethodChangedListener> mListeners = new ArrayList<>(); - private boolean mMethodInsecure; + /** Whether the user configured a secure unlock method (PIN, password, etc.) */ + private boolean mSecure; + /** Whether the unlock method is currently insecure (insecure method or trusted environment) */ + private boolean mCurrentlyInsecure; private boolean mTrustManaged; private boolean mFaceUnlockRunning; @@ -44,7 +47,7 @@ public class UnlockMethodCache { mLockPatternUtils = new LockPatternUtils(ctx); mKeyguardUpdateMonitor = KeyguardUpdateMonitor.getInstance(ctx); KeyguardUpdateMonitor.getInstance(ctx).registerCallback(mCallback); - updateMethodSecure(true /* updateAlways */); + update(true /* updateAlways */); } public static UnlockMethodCache getInstance(Context context) { @@ -55,10 +58,17 @@ public class UnlockMethodCache { } /** - * @return whether the current security method is secure, i. e. the bouncer will be shown + * @return whether the user configured a secure unlock method like PIN, password, etc. */ - public boolean isMethodInsecure() { - return mMethodInsecure; + public boolean isMethodSecure() { + return mSecure; + } + + /** + * @return whether the lockscreen is currently insecure, i. e. the bouncer won't be shown + */ + public boolean isCurrentlyInsecure() { + return mCurrentlyInsecure; } public void addListener(OnUnlockMethodChangedListener listener) { @@ -69,58 +79,59 @@ public class UnlockMethodCache { mListeners.remove(listener); } - private void updateMethodSecure(boolean updateAlways) { + private void update(boolean updateAlways) { int user = mLockPatternUtils.getCurrentUser(); - boolean methodInsecure = !mLockPatternUtils.isSecure() || - mKeyguardUpdateMonitor.getUserHasTrust(user); + boolean secure = mLockPatternUtils.isSecure(); + boolean currentlyInsecure = !secure || mKeyguardUpdateMonitor.getUserHasTrust(user); boolean trustManaged = mKeyguardUpdateMonitor.getUserTrustIsManaged(user); boolean faceUnlockRunning = mKeyguardUpdateMonitor.isFaceUnlockRunning(user) && trustManaged; - boolean changed = methodInsecure != mMethodInsecure || trustManaged != mTrustManaged - || faceUnlockRunning != mFaceUnlockRunning; + boolean changed = secure != mSecure || currentlyInsecure != mCurrentlyInsecure || + trustManaged != mTrustManaged || faceUnlockRunning != mFaceUnlockRunning; if (changed || updateAlways) { - mMethodInsecure = methodInsecure; + mSecure = secure; + mCurrentlyInsecure = currentlyInsecure; mTrustManaged = trustManaged; mFaceUnlockRunning = faceUnlockRunning; - notifyListeners(mMethodInsecure); + notifyListeners(); } } - private void notifyListeners(boolean secure) { + private void notifyListeners() { for (OnUnlockMethodChangedListener listener : mListeners) { - listener.onMethodSecureChanged(secure); + listener.onUnlockMethodStateChanged(); } } private final KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() { @Override public void onUserSwitchComplete(int userId) { - updateMethodSecure(false /* updateAlways */); + update(false /* updateAlways */); } @Override public void onTrustChanged(int userId) { - updateMethodSecure(false /* updateAlways */); + update(false /* updateAlways */); } @Override public void onTrustManagedChanged(int userId) { - updateMethodSecure(false /* updateAlways */); + update(false /* updateAlways */); } @Override public void onScreenTurnedOn() { - updateMethodSecure(false /* updateAlways */); + update(false /* updateAlways */); } @Override public void onFingerprintRecognized(int userId) { - updateMethodSecure(false /* updateAlways */); + update(false /* updateAlways */); } @Override public void onFaceUnlockStateChanged(boolean running, int userId) { - updateMethodSecure(false /* updateAlways */); + update(false /* updateAlways */); } }; @@ -133,6 +144,6 @@ public class UnlockMethodCache { } public static interface OnUnlockMethodChangedListener { - void onMethodSecureChanged(boolean methodSecure); + void onUnlockMethodStateChanged(); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/AccessPointControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/AccessPointControllerImpl.java index dc6af6a..ad4c211 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/AccessPointControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/AccessPointControllerImpl.java @@ -125,7 +125,7 @@ public class AccessPointControllerImpl implements NetworkController.AccessPointC Intent intent = new Intent(Settings.ACTION_WIFI_SETTINGS); intent.putExtra(EXTRA_START_CONNECT_SSID, ap.ssid); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - mContext.startActivityAsUser(intent, new UserHandle(mCurrentUser)); + fireSettingsIntentCallback(intent); return true; } else { WifiConfiguration config = new WifiConfiguration(); @@ -139,7 +139,13 @@ public class AccessPointControllerImpl implements NetworkController.AccessPointC return false; } - private void fireCallback(AccessPoint[] aps) { + private void fireSettingsIntentCallback(Intent intent) { + for (AccessPointCallback callback : mCallbacks) { + callback.onSettingsActivityTriggered(intent); + } + } + + private void fireAcccessPointsCallback(AccessPoint[] aps) { for (AccessPointCallback callback : mCallbacks) { callback.onAccessPointsChanged(aps); } @@ -208,7 +214,7 @@ public class AccessPointControllerImpl implements NetworkController.AccessPointC aps.add(ap); } Collections.sort(aps, mByStrength); - fireCallback(aps.toArray(new AccessPoint[aps.size()])); + fireAcccessPointsCallback(aps.toArray(new AccessPoint[aps.size()])); } private final ActionListener mConnectListener = new ActionListener() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java index 5f7d452..5eff5a6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java @@ -110,7 +110,6 @@ public class HotspotControllerImpl implements HotspotController { intent.putExtra(EXTRA_RUN_PROVISION, true); intent.putExtra(EXTRA_ENABLE_WIFI_TETHER, true); intent.setComponent(ComponentName.unflattenFromString(tetherEnable)); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startServiceAsUser(intent, UserHandle.CURRENT); } else { int wifiState = mWifiManager.getWifiState(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java index bcf08ff..3cffc85 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.policy; +import android.content.Intent; + public interface NetworkController { boolean hasMobileDataFeature(); @@ -53,6 +55,7 @@ public interface NetworkController { public interface AccessPointCallback { void onAccessPointsChanged(AccessPoint[] accessPoints); + void onSettingsActivityTriggered(Intent settingsIntent); } public static class AccessPoint { 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 b289155..9a7f21e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java @@ -195,7 +195,7 @@ public class NetworkControllerImpl extends BroadcastReceiver for (MobileSignalController mobileSignalController : mMobileSignalControllers.values()) { mobileSignalController.registerListener(); } - mSubscriptionManager.registerOnSubscriptionsChangedListener(mSubscriptionListener); + mSubscriptionManager.addOnSubscriptionsChangedListener(mSubscriptionListener); // broadcasts IntentFilter filter = new IntentFilter(); @@ -221,7 +221,7 @@ public class NetworkControllerImpl extends BroadcastReceiver for (MobileSignalController mobileSignalController : mMobileSignalControllers.values()) { mobileSignalController.unregisterListener(); } - mSubscriptionManager.unregisterOnSubscriptionsChangedListener(mSubscriptionListener); + mSubscriptionManager.removeOnSubscriptionsChangedListener(mSubscriptionListener); mContext.unregisterReceiver(this); } @@ -1187,14 +1187,17 @@ public class NetworkControllerImpl extends BroadcastReceiver String contentDescription = getStringIfExists(getContentDescription()); String dataContentDescription = getStringIfExists(icons.mDataContentDescription); + + boolean showDataIcon = mCurrentState.dataConnected && mCurrentState.inetForNetwork != 0 + || mCurrentState.iconGroup == TelephonyIcons.ROAMING; + // Only send data sim callbacks to QS. if (mCurrentState.dataSim) { - int qsTypeIcon = mCurrentState.dataConnected ? - icons.mQsDataType[mCurrentState.inetForNetwork] : 0; + int qsTypeIcon = showDataIcon ? icons.mQsDataType[mCurrentState.inetForNetwork] : 0; int length = mSignalsChangedCallbacks.size(); for (int i = 0; i < length; i++) { mSignalsChangedCallbacks.get(i).onMobileDataSignalChanged(mCurrentState.enabled - && !mCurrentState.isEmergency && !mCurrentState.airplaneMode, + && !mCurrentState.isEmergency, getQsCurrentIconId(), contentDescription, qsTypeIcon, mCurrentState.dataConnected && mCurrentState.activityIn, @@ -1205,8 +1208,6 @@ public class NetworkControllerImpl extends BroadcastReceiver icons.mIsWide && qsTypeIcon != 0); } } - boolean showDataIcon = mCurrentState.dataConnected && mCurrentState.inetForNetwork != 0 - || mCurrentState.iconGroup == TelephonyIcons.ROAMING; int typeIcon = showDataIcon ? icons.mDataType : 0; int signalClustersLength = mSignalClusters.size(); for (int i = 0; i < signalClustersLength; i++) { |