diff options
| author | 2017-12-07 23:24:02 +0000 | |
|---|---|---|
| committer | 2017-12-07 23:24:02 +0000 | |
| commit | e6d714a6365011d1d86a8398f4136c2c8335806e (patch) | |
| tree | 3fa00464e34076899c913a07303233866ba2572a | |
| parent | fdff122c680342ad9fbcfb60a968d0279eec9e6b (diff) | |
| parent | 1a891a91bc549769dd5bfccea36e266f3bf29976 (diff) | |
Merge "Improved opening performance"
6 files changed, 70 insertions, 37 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java index 5ffd7859a487..8d50d4b71cce 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java @@ -45,6 +45,7 @@ import android.widget.Toast; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto; import com.android.keyguard.KeyguardStatusView; +import com.android.keyguard.KeyguardUpdateMonitor; import com.android.settingslib.Utils; import com.android.settingslib.drawable.UserIconDrawable; import com.android.systemui.Dependency; @@ -431,7 +432,7 @@ public class QSFooterImpl extends FrameLayout implements QSFooter, @Override public void onUserInfoChanged(String name, Drawable picture, String userAccount) { if (picture != null && - UserManager.get(mContext).isGuestUser(ActivityManager.getCurrentUser()) && + UserManager.get(mContext).isGuestUser(KeyguardUpdateMonitor.getCurrentUser()) && !(picture instanceof UserIconDrawable)) { picture = picture.getConstantState().newDrawable(mContext.getResources()).mutate(); picture.setColorFilter( diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java index 4a91ee026953..cdf0c0f32d9b 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java @@ -63,6 +63,7 @@ public class QSFragment extends Fragment implements QS { private QSContainerImpl mContainer; private int mLayoutDirection; private QSFooter mFooter; + private float mLastQSExpansion = -1; @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @@ -227,6 +228,7 @@ public class QSFragment extends Fragment implements QS { public void setKeyguardShowing(boolean keyguardShowing) { if (DEBUG) Log.d(TAG, "setKeyguardShowing " + keyguardShowing); mKeyguardShowing = keyguardShowing; + mLastQSExpansion = -1; if (mQSAnimator != null) { mQSAnimator.setOnKeyguard(keyguardShowing); @@ -268,6 +270,10 @@ public class QSFragment extends Fragment implements QS { getView().setTranslationY(mKeyguardShowing ? (translationScaleY * height) : headerTranslation); } + if (expansion == mLastQSExpansion) { + return; + } + mLastQSExpansion = expansion; mHeader.setExpansion(mKeyguardShowing ? 1 : expansion); mFooter.setExpansion(mKeyguardShowing ? 1 : expansion); int heightDiff = mQSPanel.getBottom() - mHeader.getBottom() + mHeader.getPaddingBottom() diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java index b3d6e32d90ca..db19d2f0cac9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java @@ -80,10 +80,21 @@ public abstract class ExpandableOutlineView extends ExpandableView { private final ViewOutlineProvider mProvider = new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { - Path clipPath = getClipPath(); - if (clipPath != null && clipPath.isConvex()) { - // The path might not be convex in border cases where the view is small and clipped - outline.setConvexPath(clipPath); + if (!mCustomOutline && mCurrentTopRoundness == 0.0f + && mCurrentBottomRoundness == 0.0f && !mAlwaysRoundBothCorners) { + int translation = mShouldTranslateContents ? (int) getTranslation() : 0; + int left = Math.max(translation + mCurrentSidePaddings, mCurrentSidePaddings); + int top = mClipTopAmount + mBackgroundTop; + int right = getWidth() - mCurrentSidePaddings + Math.min(translation, 0); + int bottom = Math.max(getActualHeight() - mClipBottomAmount, top); + outline.setRect(left, top, right, bottom); + } else { + Path clipPath = getClipPath(); + if (clipPath != null && clipPath.isConvex()) { + // The path might not be convex in border cases where the view is small and + // clipped + outline.setConvexPath(clipPath); + } } outline.setAlpha(mOutlineAlpha); } 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 99debee2dad3..c281379fb796 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -102,7 +102,7 @@ public class KeyguardBouncer { return; } - final int activeUserId = ActivityManager.getCurrentUser(); + final int activeUserId = KeyguardUpdateMonitor.getCurrentUser(); final boolean isSystemUser = UserManager.isSplitSystemUser() && activeUserId == UserHandle.USER_SYSTEM; final boolean allowDismissKeyguard = !isSystemUser && activeUserId == keyguardUserId; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 59533e602ae1..c96742368715 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -3694,23 +3694,35 @@ public class StatusBar extends SystemUI implements DemoMode, * See also StatusBar.setPanelExpanded for another place where we attempt to do this. */ private void handleVisibleToUserChangedImpl(boolean visibleToUser) { - try { - if (visibleToUser) { - boolean pinnedHeadsUp = mHeadsUpManager.hasPinnedHeadsUp(); - boolean clearNotificationEffects = - !isPresenterFullyCollapsed() && - (mState == StatusBarState.SHADE || mState == StatusBarState.SHADE_LOCKED); - int notificationLoad = mNotificationData.getActiveNotifications().size(); - if (pinnedHeadsUp && isPresenterFullyCollapsed()) { - notificationLoad = 1; - } - mBarService.onPanelRevealed(clearNotificationEffects, notificationLoad); - } else { - mBarService.onPanelHidden(); + if (visibleToUser) { + boolean pinnedHeadsUp = mHeadsUpManager.hasPinnedHeadsUp(); + boolean clearNotificationEffects = + !isPresenterFullyCollapsed() && + (mState == StatusBarState.SHADE + || mState == StatusBarState.SHADE_LOCKED); + int notificationLoad = mNotificationData.getActiveNotifications().size(); + if (pinnedHeadsUp && isPresenterFullyCollapsed()) { + notificationLoad = 1; } - } catch (RemoteException ex) { - // Won't fail unless the world has ended. + final int finalNotificationLoad = notificationLoad; + mUiOffloadThread.submit(() -> { + try { + mBarService.onPanelRevealed(clearNotificationEffects, + finalNotificationLoad); + } catch (RemoteException ex) { + // Won't fail unless the world has ended. + } + }); + } else { + mUiOffloadThread.submit(() -> { + try { + mBarService.onPanelHidden(); + } catch (RemoteException ex) { + // Won't fail unless the world has ended. + } + }); } + } private void stopNotificationLogging() { @@ -3746,21 +3758,23 @@ public class StatusBar extends SystemUI implements DemoMode, newlyVisible.toArray(new NotificationVisibility[newlyVisible.size()]); NotificationVisibility[] noLongerVisibleAr = noLongerVisible.toArray(new NotificationVisibility[noLongerVisible.size()]); - try { - mBarService.onNotificationVisibilityChanged(newlyVisibleAr, noLongerVisibleAr); - } catch (RemoteException e) { - // Ignore. - } - - final int N = newlyVisible.size(); - if (N > 0) { - String[] newlyVisibleKeyAr = new String[N]; - for (int i = 0; i < N; i++) { - newlyVisibleKeyAr[i] = newlyVisibleAr[i].key; + mUiOffloadThread.submit(() -> { + try { + mBarService.onNotificationVisibilityChanged(newlyVisibleAr, noLongerVisibleAr); + } catch (RemoteException e) { + // Ignore. } - setNotificationsShown(newlyVisibleKeyAr); - } + final int N = newlyVisible.size(); + if (N > 0) { + String[] newlyVisibleKeyAr = new String[N]; + for (int i = 0; i < N; i++) { + newlyVisibleKeyAr[i] = newlyVisibleAr[i].key; + } + + setNotificationsShown(newlyVisibleKeyAr); + } + }); } // State logging diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java index 0aeb7b6bf34c..5ff90d91b333 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java @@ -430,6 +430,7 @@ public class StatusBarTest extends SysuiTestCase { public void testLogHidden() { try { mStatusBar.handleVisibleToUserChanged(false); + waitForUiOffloadThread(); verify(mBarService, times(1)).onPanelHidden(); verify(mBarService, never()).onPanelRevealed(anyBoolean(), anyInt()); } catch (RemoteException e) { @@ -447,7 +448,7 @@ public class StatusBarTest extends SysuiTestCase { try { mStatusBar.handleVisibleToUserChanged(true); - + waitForUiOffloadThread(); verify(mBarService, never()).onPanelHidden(); verify(mBarService, times(1)).onPanelRevealed(false, 1); } catch (RemoteException e) { @@ -466,7 +467,7 @@ public class StatusBarTest extends SysuiTestCase { try { mStatusBar.handleVisibleToUserChanged(true); - + waitForUiOffloadThread(); verify(mBarService, never()).onPanelHidden(); verify(mBarService, times(1)).onPanelRevealed(true, 5); } catch (RemoteException e) { @@ -485,7 +486,7 @@ public class StatusBarTest extends SysuiTestCase { try { mStatusBar.handleVisibleToUserChanged(true); - + waitForUiOffloadThread(); verify(mBarService, never()).onPanelHidden(); verify(mBarService, times(1)).onPanelRevealed(false, 5); } catch (RemoteException e) { |