diff options
18 files changed, 242 insertions, 22 deletions
diff --git a/core/res/res/layout/notification_material_action_list.xml b/core/res/res/layout/notification_material_action_list.xml index 547d3cafb621..4670dcabe211 100644 --- a/core/res/res/layout/notification_material_action_list.xml +++ b/core/res/res/layout/notification_material_action_list.xml @@ -21,7 +21,7 @@ <com.android.internal.widget.NotificationActionListLayout android:id="@+id/actions" android:layout_width="match_parent" - android:layout_height="56dp" + android:layout_height="@dimen/notification_action_list_height" android:paddingEnd="4dp" android:orientation="horizontal" android:gravity="center_vertical" diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index 8ce922eedd5c..3ba6ce1be034 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -152,6 +152,9 @@ <!-- The margin on the end of the content view with a picture.--> <dimen name="notification_content_picture_margin">56dp</dimen> + <!-- The height of the notification action list --> + <dimen name="notification_action_list_height">56dp</dimen> + <!-- height of the content margin to accomodate for the header --> <dimen name="notification_content_margin_top">37.5dp</dimen> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index c64a93485b07..29818df192e4 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2584,6 +2584,8 @@ <java-symbol type="dimen" name="input_extract_action_button_width" /> <java-symbol type="dimen" name="input_extract_action_button_height" /> + <java-symbol type="dimen" name="notification_action_list_height" /> + <!-- TV Remote Service package --> <java-symbol type="string" name="config_tvRemoteServicePackage" /> diff --git a/docs/html/_redirects.yaml b/docs/html/_redirects.yaml index f0986aa05f83..efe0f8a1d2fa 100644 --- a/docs/html/_redirects.yaml +++ b/docs/html/_redirects.yaml @@ -988,7 +988,7 @@ redirects: - from: /tools/help/theme-editor.html to: /studio/write/theme-editor.html - from: /tools/help/traceview.html - to: /studio/profile/traceview-commandline.html + to: /studio/profile/traceview.html - from: /tools/help/translations-editor.html to: /studio/write/translations-editor.html - from: /tools/help/uiautomator/Configurator.html @@ -1113,6 +1113,26 @@ redirects: to: /studio/test/index.html - from: /tools/testing/testing-tools.html to: /studio/test/index.html +- from: /tools/performance/importing-legacy-apps.html + to: /studio/projects/index.html +- from: /tools/performance/comparison.html + to: /studio/profile/android-monitor.html +- from: /tools/performance/memory-monitor/index.html + to: /studio/profile/am-memory.html +- from: /tools/devices/index.html + to: /studio/run/managing-avds.html +- from: /tools/extras/index.html + to: /studio/intro/update.html +- from: /tools/workflow.html + to: /studio/guide/workflow.html +- from: /installing/studio-androidview.html + to: /studio/projects/index.html +- from: /installing/studio-tips.html + to: /studio/guide/guide-intro.html +- from: /tools/help/ddms.html + to: /studio/profile/ddms.html +- from: /tools/revisions/index.html + to: /studio/releases/index.html # Just incase something was missed, go to intro page diff --git a/packages/DocumentsUI/Android.mk b/packages/DocumentsUI/Android.mk index 568e200fbd98..9d44a6deb0c8 100644 --- a/packages/DocumentsUI/Android.mk +++ b/packages/DocumentsUI/Android.mk @@ -36,7 +36,7 @@ LOCAL_JACK_FLAGS := \ # Only enable asserts on userdebug/eng builds ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) -LOCAL_JACK_FLAGS += -D jack.assert.policy=enable +LOCAL_JACK_FLAGS += -D jack.assert.policy=always endif LOCAL_PACKAGE_NAME := DocumentsUI diff --git a/packages/MtpDocumentsProvider/Android.mk b/packages/MtpDocumentsProvider/Android.mk index 0f945ee8a5e1..c9e7195808d2 100644 --- a/packages/MtpDocumentsProvider/Android.mk +++ b/packages/MtpDocumentsProvider/Android.mk @@ -11,7 +11,7 @@ LOCAL_PROGUARD_FLAG_FILES := proguard.flags # Only enable asserts on userdebug/eng builds ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) -LOCAL_JACK_FLAGS += -D jack.assert.policy=enable +LOCAL_JACK_FLAGS += -D jack.assert.policy=always endif include $(BUILD_PACKAGE) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java index 34c9c0de4459..078b3c6bbdea 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java @@ -374,10 +374,42 @@ public class NotificationContentView extends FrameLayout { mContentHeight = Math.max(Math.min(contentHeight, getHeight()), getMinHeight());; mUnrestrictedContentHeight = Math.max(contentHeight, getMinHeight()); selectLayout(mAnimate /* animate */, false /* force */); + + int minHeightHint = getMinContentHeightHint(); + + NotificationViewWrapper wrapper = getVisibleWrapper(mVisibleType); + if (wrapper != null) { + wrapper.setContentHeight(mContentHeight, minHeightHint); + } + + wrapper = getVisibleWrapper(mTransformationStartVisibleType); + if (wrapper != null) { + wrapper.setContentHeight(mContentHeight, minHeightHint); + } + updateClipping(); invalidateOutline(); } + /** + * @return the minimum apparent height that the wrapper should allow for the purpose + * of aligning elements at the bottom edge. If this is larger than the content + * height, the notification is clipped instead of being further shrunk. + */ + private int getMinContentHeightHint() { + if (mIsChildInGroup && (mVisibleType == VISIBLE_TYPE_SINGLELINE + || mTransformationStartVisibleType == VISIBLE_TYPE_SINGLELINE)) { + return mContext.getResources().getDimensionPixelSize( + com.android.internal.R.dimen.notification_action_list_height); + } + if (mHeadsUpChild != null) { + return mHeadsUpChild.getHeight(); + } else { + return mContractedChild.getHeight() + mContext.getResources().getDimensionPixelSize( + com.android.internal.R.dimen.notification_action_list_height); + } + } + private void updateContentTransformation() { int visibleType = calculateVisibleType(); if (visibleType != mVisibleType) { @@ -493,11 +525,15 @@ public class NotificationContentView extends FrameLayout { } else { int visibleType = calculateVisibleType(); if (visibleType != mVisibleType || force) { - View visibleView = getViewForVisibleType(visibleType); - if (visibleView != null) { - visibleView.setVisibility(VISIBLE); - transferRemoteInputFocus(visibleType); - } + View visibleView = getViewForVisibleType(visibleType); + if (visibleView != null) { + visibleView.setVisibility(VISIBLE); + transferRemoteInputFocus(visibleType); + } + NotificationViewWrapper visibleWrapper = getVisibleWrapper(visibleType); + if (visibleWrapper != null) { + visibleWrapper.setContentHeight(mContentHeight, getMinContentHeightHint()); + } if (animate && ((visibleType == VISIBLE_TYPE_EXPANDED && mExpandedChild != null) || (visibleType == VISIBLE_TYPE_HEADSUP && mHeadsUpChild != null) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActionListTransformState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActionListTransformState.java new file mode 100644 index 000000000000..c0373bef0f5a --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActionListTransformState.java @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2016 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.statusbar.notification; + +import android.text.Layout; +import android.text.TextUtils; +import android.util.Pools; +import android.view.View; +import android.widget.TextView; + +/** + * A transform state of the action list +*/ +public class ActionListTransformState extends TransformState { + + private static Pools.SimplePool<ActionListTransformState> sInstancePool + = new Pools.SimplePool<>(40); + + @Override + protected boolean sameAs(TransformState otherState) { + return otherState instanceof ActionListTransformState; + } + + public static ActionListTransformState obtain() { + ActionListTransformState instance = sInstancePool.acquire(); + if (instance != null) { + return instance; + } + return new ActionListTransformState(); + } + + @Override + protected void resetTransformedView() { + // We need to keep the Y transformation, because this is used to keep the action list + // aligned at the bottom, unrelated to transforms. + float y = getTransformedView().getTranslationY(); + super.resetTransformedView(); + getTransformedView().setTranslationY(y); + } + + @Override + public void recycle() { + super.recycle(); + sInstancePool.release(this); + } +} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java index 889bd5cac7a5..7ca2df99d76e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java @@ -41,6 +41,10 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp private ProgressBar mProgressBar; private TextView mTitle; private TextView mText; + private View mActionsContainer; + + private int mContentHeight; + private int mMinHeightHint; protected NotificationTemplateViewWrapper(Context ctx, View view, ExpandableNotificationRow row) { super(ctx, view, row); @@ -123,6 +127,7 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp // It's still a viewstub mProgressBar = null; } + mActionsContainer = mView.findViewById(com.android.internal.R.id.actions_container); } @Override @@ -225,4 +230,21 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp (int) (gSource * (1f - t) + gTarget * t), (int) (bSource * (1f - t) + bTarget * t)); } + + @Override + public void setContentHeight(int contentHeight, int minHeightHint) { + super.setContentHeight(contentHeight, minHeightHint); + + mContentHeight = contentHeight; + mMinHeightHint = minHeightHint; + updateActionOffset(); + } + + private void updateActionOffset() { + if (mActionsContainer != null) { + // We should never push the actions higher than they are in the headsup view. + int constrainedContentHeight = Math.max(mContentHeight, mMinHeightHint); + mActionsContainer.setTranslationY(constrainedContentHeight - mView.getHeight()); + } + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java index 7a0df1f54c64..22519e6e4de3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java @@ -158,4 +158,7 @@ public abstract class NotificationViewWrapper implements TransformableView { public void setShowingLegacyBackground(boolean showing) { } + + public void setContentHeight(int contentHeight, int minHeightHint) { + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java index 8207215ec4a9..4e643f0fcae1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java @@ -374,6 +374,11 @@ public class TransformState { result.initFrom(view); return result; } + if (view.getId() == com.android.internal.R.id.actions_container) { + ActionListTransformState result = ActionListTransformState.obtain(); + result.initFrom(view); + return result; + } if (view instanceof NotificationHeaderView) { HeaderTransformState result = HeaderTransformState.obtain(); result.initFrom(view); @@ -467,7 +472,7 @@ public class TransformState { resetTransformedView(); } - private void resetTransformedView() { + protected void resetTransformedView() { mTransformedView.setTranslationX(0); mTransformedView.setTranslationY(0); mTransformedView.setScaleX(1.0f); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java index a855aed88694..095265a0f329 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java @@ -272,7 +272,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene public boolean requestScrollTo() { findScrollContainer(); - mScrollContainer.scrollTo(mScrollContainerChild); + mScrollContainer.lockScrollTo(mScrollContainerChild); return true; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index ffa246ae3fdc..33b113aee81d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -243,6 +243,7 @@ public class NotificationStackScrollLayout extends ViewGroup = new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { + updateForcedScroll(); updateChildren(); mChildrenUpdateRequested = false; getViewTreeObserver().removeOnPreDrawListener(this); @@ -334,6 +335,7 @@ public class NotificationStackScrollLayout extends ViewGroup private boolean mDrawBackgroundAsSrc; private boolean mFadedOut; private boolean mGroupExpandedForMeasure; + private View mForcedScroll; private float mBackgroundFadeAmount = 1.0f; private static final Property<NotificationStackScrollLayout, Float> BACKGROUND_FADE = new FloatProperty<NotificationStackScrollLayout>("backgroundFade") { @@ -591,6 +593,23 @@ public class NotificationStackScrollLayout extends ViewGroup clampScrollPosition(); } + private void updateForcedScroll() { + if (mForcedScroll != null && (!mForcedScroll.hasFocus() + || !mForcedScroll.isAttachedToWindow())) { + mForcedScroll = null; + } + if (mForcedScroll != null) { + ExpandableView expandableView = (ExpandableView) mForcedScroll; + int positionInLinearLayout = getPositionInLinearLayout(expandableView); + int targetScroll = targetScrollForView(expandableView, positionInLinearLayout); + + targetScroll = Math.max(0, Math.min(targetScroll, getScrollRange())); + if (mOwnScrollY < targetScroll || positionInLinearLayout < mOwnScrollY) { + mOwnScrollY = targetScroll; + } + } + } + private void requestChildrenUpdate() { if (!mChildrenUpdateRequested) { getViewTreeObserver().addOnPreDrawListener(mChildrenUpdater); @@ -978,11 +997,19 @@ public class NotificationStackScrollLayout extends ViewGroup mScrollingEnabled = enable; } + @Override + public void lockScrollTo(View v) { + if (mForcedScroll == v) { + return; + } + mForcedScroll = v; + scrollTo(v); + } + + @Override public boolean scrollTo(View v) { ExpandableView expandableView = (ExpandableView) v; - int positionInLinearLayout = getPositionInLinearLayout(v); - int targetScroll = positionInLinearLayout + expandableView.getIntrinsicHeight() + - getImeInset() - getHeight() + getTopPadding(); + int targetScroll = targetScrollForView(expandableView, getPositionInLinearLayout(v)); if (mOwnScrollY < targetScroll) { mScroller.startScroll(mScrollX, mOwnScrollY, 0, targetScroll - mOwnScrollY); @@ -993,6 +1020,15 @@ public class NotificationStackScrollLayout extends ViewGroup return false; } + /** + * @return the scroll necessary to make the bottom edge of {@param v} align with the top of + * the IME. + */ + private int targetScrollForView(ExpandableView v, int positionInLinearLayout) { + return positionInLinearLayout + v.getIntrinsicHeight() + + getImeInset() - getHeight() + getTopPadding(); + } + @Override public WindowInsets onApplyWindowInsets(WindowInsets insets) { mBottomInset = insets.getSystemWindowInsetBottom(); @@ -1111,6 +1147,7 @@ public class NotificationStackScrollLayout extends ViewGroup if (ev.getY() < mQsContainer.getBottom()) { return false; } + mForcedScroll = null; initVelocityTrackerIfNotExists(); mVelocityTracker.addMovement(ev); @@ -2787,6 +2824,14 @@ public class NotificationStackScrollLayout extends ViewGroup } @Override + public void clearChildFocus(View child) { + super.clearChildFocus(child); + if (mForcedScroll == child) { + mForcedScroll = null; + } + } + + @Override public void requestDisallowLongPress() { removeLongPressCallback(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/ScrollContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/ScrollContainer.java index 17b7871bbfe0..b9d12ce8f151 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/ScrollContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/ScrollContainer.java @@ -36,6 +36,12 @@ public interface ScrollContainer { boolean scrollTo(View v); /** + * Like {@link #scrollTo(View)}, but keeps the scroll locked until the user + * scrolls, or {@param v} loses focus or is detached. + */ + void lockScrollTo(View v); + + /** * Request that the view does not dismiss for the current touch. */ void requestDisallowDismiss(); diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 379c24931453..4e48e4d7f6d6 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -226,6 +226,7 @@ import com.android.internal.app.IMediaContainerService; import com.android.internal.app.ResolverActivity; import com.android.internal.content.NativeLibraryHelper; import com.android.internal.content.PackageHelper; +import com.android.internal.logging.MetricsLogger; import com.android.internal.os.IParcelFileDescriptorFactory; import com.android.internal.os.InstallerConnection.InstallerException; import com.android.internal.os.SomeArgs; @@ -7220,8 +7221,16 @@ public class PackageManagerService extends IPackageManager.Stub { } } - final int elapsedTime = (int) TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime); - // TODO: Log events using MetricsLogger.histogram / MetricsLogger.count + final int elapsedTimeMs = (int) TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime); + // Report the elapsed time in deci-seconds (tenths of a second) rounded upwards + // (e.g. 1234 ms will become 13ds). This will help provide histograms at a more reasonable + // granularity. + final int elapsedTimeDs = ((elapsedTimeMs + 99) / 100); + MetricsLogger.histogram(mContext, "opt_dialog_num_dexopted", numberOfPackagesOptimized); + MetricsLogger.histogram(mContext, "opt_dialog_num_skipped", numberOfPackagesSkipped); + MetricsLogger.histogram(mContext, "opt_dialog_num_failed", numberOfPackagesFailed); + MetricsLogger.histogram(mContext, "opt_dialog_num_total", getOptimizablePackages().size()); + MetricsLogger.histogram(mContext, "opt_dialog_time_decis", elapsedTimeDs); } @Override diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java index 805c986b1445..de613aaa94ad 100644 --- a/services/core/java/com/android/server/wm/AppWindowToken.java +++ b/services/core/java/com/android/server/wm/AppWindowToken.java @@ -329,11 +329,14 @@ class AppWindowToken extends WindowToken { final DisplayContentList displayList = new DisplayContentList(); for (int i = allWindows.size() - 1; i >= 0; i--) { final WindowState win = allWindows.get(i); - if (!win.mDestroying) { + + if (!(mAppStopped || win.mWindowRemovalAllowed)) { continue; } - if (!(mAppStopped || win.mWindowRemovalAllowed)) { + win.mWinAnimator.destroyPreservedSurfaceLocked(); + + if (!win.mDestroying) { continue; } diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 1fdc714dbf5a..fba439f8ca60 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -378,6 +378,8 @@ class DisplayContent { * We save the focused task region once we find it, and add it back at the end. */ + task.getDimBounds(mTmpRect); + if (task == focusedTask) { addBackFocusedTask = true; mTmpRect2.set(mTmpRect); @@ -385,7 +387,6 @@ class DisplayContent { final boolean isFreeformed = task.inFreeformWorkspace(); if (task != focusedTask || isFreeformed) { - task.getDimBounds(mTmpRect); if (isFreeformed) { // If the task is freeformed, enlarge the area to account for outside // touch area for resize. diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index e5f603c7865b..f88e30b3c5e5 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -659,6 +659,13 @@ class WindowStateAnimator { mDestroyPreservedSurfaceUponRedraw = false; } + void markPreservedSurfaceForDestroy() { + if (mDestroyPreservedSurfaceUponRedraw + && !mService.mDestroyPreservedSurface.contains(mWin)) { + mService.mDestroyPreservedSurface.add(mWin); + } + } + WindowSurfaceController createSurfaceLocked() { final WindowState w = mWin; if (w.hasSavedSurface()) { @@ -1518,9 +1525,7 @@ class WindowStateAnimator { if (prepared && mLastHidden && mDrawState == HAS_DRAWN) { if (showSurfaceRobustlyLocked()) { - if (mDestroyPreservedSurfaceUponRedraw) { - mService.mDestroyPreservedSurface.add(mWin); - } + markPreservedSurfaceForDestroy(); mAnimator.requestRemovalOfReplacedWindows(w); mLastHidden = false; if (mIsWallpaper) { |