Merge "Decrease the key progress increment step size to allow finer control of seekbar using keys. Bug:26926346 Change-Id: Ic7d290552c102d8602275f19dac4d57de4a53297"
diff --git a/api/current.txt b/api/current.txt
index 5361d0a..dd9b5a1 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -34369,6 +34369,9 @@
ctor public MediaBrowserService.BrowserRoot(java.lang.String, android.os.Bundle);
method public android.os.Bundle getExtras();
method public java.lang.String getRootId();
+ field public static final java.lang.String EXTRA_OFFLINE = "android.service.media.extra.OFFLINE";
+ field public static final java.lang.String EXTRA_RECENT = "android.service.media.extra.RECENT";
+ field public static final java.lang.String EXTRA_SUGGESTED = "android.service.media.extra.SUGGESTED";
}
public class MediaBrowserService.Result {
@@ -40070,7 +40073,6 @@
method public static android.util.LocaleList getDefault();
method public static android.util.LocaleList getEmptyLocaleList();
method public java.util.Locale getFirstMatch(java.lang.String[]);
- method public java.util.Locale getPrimary();
method public int indexOf(java.util.Locale);
method public boolean isEmpty();
method public static void setDefault(android.util.LocaleList);
diff --git a/api/system-current.txt b/api/system-current.txt
index a43e3f6..ef4841e 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -36779,6 +36779,9 @@
ctor public MediaBrowserService.BrowserRoot(java.lang.String, android.os.Bundle);
method public android.os.Bundle getExtras();
method public java.lang.String getRootId();
+ field public static final java.lang.String EXTRA_OFFLINE = "android.service.media.extra.OFFLINE";
+ field public static final java.lang.String EXTRA_RECENT = "android.service.media.extra.RECENT";
+ field public static final java.lang.String EXTRA_SUGGESTED = "android.service.media.extra.SUGGESTED";
}
public class MediaBrowserService.Result {
@@ -42718,7 +42721,6 @@
method public static android.util.LocaleList getDefault();
method public static android.util.LocaleList getEmptyLocaleList();
method public java.util.Locale getFirstMatch(java.lang.String[]);
- method public java.util.Locale getPrimary();
method public int indexOf(java.util.Locale);
method public boolean isEmpty();
method public static void setDefault(android.util.LocaleList);
diff --git a/api/test-current.txt b/api/test-current.txt
index 278a47d..80d82c3 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -34384,6 +34384,9 @@
ctor public MediaBrowserService.BrowserRoot(java.lang.String, android.os.Bundle);
method public android.os.Bundle getExtras();
method public java.lang.String getRootId();
+ field public static final java.lang.String EXTRA_OFFLINE = "android.service.media.extra.OFFLINE";
+ field public static final java.lang.String EXTRA_RECENT = "android.service.media.extra.RECENT";
+ field public static final java.lang.String EXTRA_SUGGESTED = "android.service.media.extra.SUGGESTED";
}
public class MediaBrowserService.Result {
@@ -40087,7 +40090,6 @@
method public static android.util.LocaleList getDefault();
method public static android.util.LocaleList getEmptyLocaleList();
method public java.util.Locale getFirstMatch(java.lang.String[]);
- method public java.util.Locale getPrimary();
method public int indexOf(java.util.Locale);
method public boolean isEmpty();
method public static void setDefault(android.util.LocaleList);
diff --git a/core/java/android/animation/AnimatorSet.java b/core/java/android/animation/AnimatorSet.java
index 980329f..1ab55dd 100644
--- a/core/java/android/animation/AnimatorSet.java
+++ b/core/java/android/animation/AnimatorSet.java
@@ -1030,20 +1030,6 @@
}
}
- /**
- * @hide
- * TODO: For animatorSet defined in XML, we can use a flag to indicate what the play order
- * if defined (i.e. sequential or together), then we can use the flag instead of calculate
- * dynamically.
- * @return whether all the animators in the set are supposed to play together
- */
- public boolean shouldPlayTogether() {
- updateAnimatorsDuration();
- createDependencyGraph();
- // All the child nodes are set out to play right after the delay animation
- return mRootNode.mChildNodes.size() == mNodes.size() - 1;
- }
-
@Override
public long getTotalDuration() {
updateAnimatorsDuration();
diff --git a/core/java/android/animation/PathKeyframes.java b/core/java/android/animation/PathKeyframes.java
index 8230ac5..2a47b68 100644
--- a/core/java/android/animation/PathKeyframes.java
+++ b/core/java/android/animation/PathKeyframes.java
@@ -231,7 +231,7 @@
}
}
- abstract static class IntKeyframesBase extends SimpleKeyframes implements IntKeyframes {
+ private abstract static class IntKeyframesBase extends SimpleKeyframes implements IntKeyframes {
@Override
public Class getType() {
return Integer.class;
@@ -243,7 +243,7 @@
}
}
- abstract static class FloatKeyframesBase extends SimpleKeyframes
+ private abstract static class FloatKeyframesBase extends SimpleKeyframes
implements FloatKeyframes {
@Override
public Class getType() {
diff --git a/core/java/android/animation/PropertyValuesHolder.java b/core/java/android/animation/PropertyValuesHolder.java
index 6ba5b96..e993cca 100644
--- a/core/java/android/animation/PropertyValuesHolder.java
+++ b/core/java/android/animation/PropertyValuesHolder.java
@@ -21,7 +21,6 @@
import android.util.FloatProperty;
import android.util.IntProperty;
import android.util.Log;
-import android.util.PathParser;
import android.util.Property;
import java.lang.reflect.InvocationTargetException;
@@ -1047,43 +1046,6 @@
return mAnimatedValue;
}
- /**
- * PropertyValuesHolder is Animators use to hold internal animation related data.
- * Therefore, in order to replicate the animation behavior, we need to get data out of
- * PropertyValuesHolder.
- * @hide
- */
- public void getPropertyValues(PropertyValues values) {
- init();
- values.propertyName = mPropertyName;
- values.type = mValueType;
- values.startValue = mKeyframes.getValue(0);
- if (values.startValue instanceof PathParser.PathData) {
- // PathData evaluator returns the same mutable PathData object when query fraction,
- // so we have to make a copy here.
- values.startValue = new PathParser.PathData((PathParser.PathData) values.startValue);
- }
- values.endValue = mKeyframes.getValue(1);
- if (values.endValue instanceof PathParser.PathData) {
- // PathData evaluator returns the same mutable PathData object when query fraction,
- // so we have to make a copy here.
- values.endValue = new PathParser.PathData((PathParser.PathData) values.endValue);
- }
- // TODO: We need a better way to get data out of keyframes.
- if (mKeyframes instanceof PathKeyframes.FloatKeyframesBase
- || mKeyframes instanceof PathKeyframes.IntKeyframesBase) {
- // property values will animate based on external data source (e.g. Path)
- values.dataSource = new PropertyValues.DataSource() {
- @Override
- public Object getValueAtFraction(float fraction) {
- return mKeyframes.getValue(fraction);
- }
- };
- } else {
- values.dataSource = null;
- }
- }
-
@Override
public String toString() {
return mPropertyName + ": " + mKeyframes.toString();
@@ -1639,24 +1601,6 @@
}
};
- /**
- * @hide
- */
- public static class PropertyValues {
- public String propertyName;
- public Class type;
- public Object startValue;
- public Object endValue;
- public DataSource dataSource = null;
- public interface DataSource {
- Object getValueAtFraction(float fraction);
- }
- public String toString() {
- return ("property name: " + propertyName + ", type: " + type + ", startValue: "
- + startValue.toString() + ", endValue: " + endValue.toString());
- }
- }
-
native static private long nGetIntMethod(Class targetClass, String methodName);
native static private long nGetFloatMethod(Class targetClass, String methodName);
native static private long nGetMultipleIntMethod(Class targetClass, String methodName,
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 805b203..6424520 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -4822,14 +4822,12 @@
}
private void updateDefaultDensity() {
- if (mCurDefaultDisplayDpi != Configuration.DENSITY_DPI_UNDEFINED
- && mCurDefaultDisplayDpi != DisplayMetrics.DENSITY_DEVICE
- && !mDensityCompatMode) {
- Slog.i(TAG, "Switching default density from "
- + DisplayMetrics.DENSITY_DEVICE + " to "
- + mCurDefaultDisplayDpi);
- DisplayMetrics.DENSITY_DEVICE = mCurDefaultDisplayDpi;
- Bitmap.setDefaultDensity(DisplayMetrics.DENSITY_DEFAULT);
+ final int densityDpi = mCurDefaultDisplayDpi;
+ if (!mDensityCompatMode
+ && densityDpi != Configuration.DENSITY_DPI_UNDEFINED
+ && densityDpi != DisplayMetrics.DENSITY_DEVICE) {
+ DisplayMetrics.DENSITY_DEVICE = densityDpi;
+ Bitmap.setDefaultDensity(densityDpi);
}
}
diff --git a/core/java/android/app/LoadedApk.java b/core/java/android/app/LoadedApk.java
index 1e22bef..da52c1e 100644
--- a/core/java/android/app/LoadedApk.java
+++ b/core/java/android/app/LoadedApk.java
@@ -382,6 +382,13 @@
libraryPermittedPath += File.pathSeparator +
System.getProperty("java.library.path");
}
+ // DO NOT SHIP: this is a workaround for apps loading native libraries
+ // provided by 3rd party apps using absolute path instead of corresponding
+ // classloader; see http://b/26954419 for example.
+ if (mApplicationInfo.targetSdkVersion <= 23) {
+ libraryPermittedPath += File.pathSeparator + "/data/app";
+ }
+ // -----------------------------------------------------------------------------
final String librarySearchPath = TextUtils.join(File.pathSeparator, libPaths);
diff --git a/core/java/android/app/job/JobInfo.java b/core/java/android/app/job/JobInfo.java
index b2ca023..5398e7f 100644
--- a/core/java/android/app/job/JobInfo.java
+++ b/core/java/android/app/job/JobInfo.java
@@ -24,6 +24,7 @@
import android.os.Parcelable;
import android.os.PersistableBundle;
import android.util.Log;
+import static android.util.TimeUtils.formatForLogging;
import java.util.ArrayList;
@@ -640,12 +641,14 @@
}
JobInfo job = new JobInfo(this);
if (job.intervalMillis != job.getIntervalMillis()) {
- Log.w(TAG, "Specified interval is less than minimum interval. Clamped to "
- + job.getIntervalMillis());
+ Log.w(TAG, "Specified interval for " + mJobService.getPackageName() + " is "
+ + formatForLogging(mIntervalMillis) + ". Clamped to " +
+ formatForLogging(job.getIntervalMillis()));
}
if (job.flexMillis != job.getFlexMillis()) {
- Log.w(TAG, "Specified flex is less than minimum flex. Clamped to "
- + job.getFlexMillis());
+ Log.w(TAG, "Specified interval for " + mJobService.getPackageName() + " is "
+ + formatForLogging(mFlexMillis) + ". Clamped to " +
+ formatForLogging(job.getFlexMillis()));
}
return job;
}
diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java
index 7db5a08..be4f895 100644
--- a/core/java/android/content/res/Configuration.java
+++ b/core/java/android/content/res/Configuration.java
@@ -715,7 +715,7 @@
* about setLocales() has changed locale directly. */
private void fixUpLocaleList() {
if ((locale == null && !mLocaleList.isEmpty()) ||
- (locale != null && !locale.equals(mLocaleList.getPrimary()))) {
+ (locale != null && !locale.equals(mLocaleList.get(0)))) {
mLocaleList = new LocaleList(locale);
}
}
@@ -1269,7 +1269,7 @@
localeArray[i] = Locale.forLanguageTag(source.readString());
}
mLocaleList = new LocaleList(localeArray);
- locale = mLocaleList.getPrimary();
+ locale = mLocaleList.get(0);
userSetLocale = (source.readInt()==1);
touchscreen = source.readInt();
@@ -1435,7 +1435,7 @@
*/
public void setLocales(@Nullable LocaleList locales) {
mLocaleList = locales == null ? LocaleList.getEmptyLocaleList() : locales;
- locale = mLocaleList.getPrimary();
+ locale = mLocaleList.get(0);
setLayoutDirection(locale);
}
@@ -1900,7 +1900,7 @@
final String localesStr = XmlUtils.readStringAttribute(parser, XML_ATTR_LOCALES);
configOut.mLocaleList = LocaleList.forLanguageTags(localesStr);
- configOut.locale = configOut.mLocaleList.getPrimary();
+ configOut.locale = configOut.mLocaleList.get(0);
configOut.touchscreen = XmlUtils.readIntAttribute(parser, XML_ATTR_TOUCHSCREEN,
TOUCHSCREEN_UNDEFINED);
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index 4967d05..915fae0 100644
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -381,7 +381,7 @@
private PluralRules getPluralRule() {
synchronized (sSync) {
if (mPluralRule == null) {
- mPluralRule = PluralRules.forLocale(mConfiguration.getLocales().getPrimary());
+ mPluralRule = PluralRules.forLocale(mConfiguration.getLocales().get(0));
}
return mPluralRule;
}
@@ -444,7 +444,7 @@
@NonNull
public String getString(@StringRes int id, Object... formatArgs) throws NotFoundException {
final String raw = getString(id);
- return String.format(mConfiguration.getLocales().getPrimary(), raw, formatArgs);
+ return String.format(mConfiguration.getLocales().get(0), raw, formatArgs);
}
/**
@@ -475,7 +475,7 @@
public String getQuantityString(@PluralsRes int id, int quantity, Object... formatArgs)
throws NotFoundException {
String raw = getQuantityText(id, quantity).toString();
- return String.format(mConfiguration.getLocales().getPrimary(), raw, formatArgs);
+ return String.format(mConfiguration.getLocales().get(0), raw, formatArgs);
}
/**
@@ -1971,7 +1971,7 @@
}
mAssets.setConfiguration(mConfiguration.mcc, mConfiguration.mnc,
- adjustLanguageTag(locales.getPrimary().toLanguageTag()),
+ adjustLanguageTag(locales.get(0).toLanguageTag()),
mConfiguration.orientation,
mConfiguration.touchscreen,
mConfiguration.densityDpi, mConfiguration.keyboard,
@@ -1996,7 +1996,7 @@
}
synchronized (sSync) {
if (mPluralRule != null) {
- mPluralRule = PluralRules.forLocale(mConfiguration.getLocales().getPrimary());
+ mPluralRule = PluralRules.forLocale(mConfiguration.getLocales().get(0));
}
}
}
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index dfc8601..7830142 100755
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -3869,7 +3869,6 @@
MOVED_TO_GLOBAL.add(Settings.Global.DATA_ROAMING);
MOVED_TO_GLOBAL.add(Settings.Global.DEVELOPMENT_SETTINGS_ENABLED);
MOVED_TO_GLOBAL.add(Settings.Global.DEVICE_PROVISIONED);
- MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_DENSITY_FORCED);
MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_SIZE_FORCED);
MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE);
MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE);
@@ -5104,6 +5103,15 @@
"disabled_print_services";
/**
+ * The saved value for WindowManagerService.setForcedDisplayDensity()
+ * formatted as a single integer representing DPI. If unset, then use
+ * the real display density.
+ *
+ * @hide
+ */
+ public static final String DISPLAY_DENSITY_FORCED = "display_density_forced";
+
+ /**
* Setting to always use the default text-to-speech settings regardless
* of the application settings.
* 1 = override application settings,
@@ -6535,13 +6543,6 @@
public static final String DEVICE_PROVISIONED = "device_provisioned";
/**
- * The saved value for WindowManagerService.setForcedDisplayDensity().
- * One integer in dpi. If unset, then use the real display density.
- * @hide
- */
- public static final String DISPLAY_DENSITY_FORCED = "display_density_forced";
-
- /**
* The saved value for WindowManagerService.setForcedDisplaySize().
* Two integers separated by a comma. If unset, then use the real display size.
* @hide
diff --git a/core/java/android/text/style/LocaleSpan.java b/core/java/android/text/style/LocaleSpan.java
index 117de774..4f687c8 100644
--- a/core/java/android/text/style/LocaleSpan.java
+++ b/core/java/android/text/style/LocaleSpan.java
@@ -97,12 +97,12 @@
* @return The {@link Locale} for this span. If multiple locales are associated with this
* span, only the first locale is returned. {@code null} if no {@link Locale} is specified.
*
- * @see LocaleList#getPrimary()
+ * @see LocaleList#get()
* @see #getLocales()
*/
@Nullable
public Locale getLocale() {
- return mLocales.getPrimary();
+ return mLocales.get(0);
}
/**
diff --git a/core/java/android/util/LocaleList.java b/core/java/android/util/LocaleList.java
index 90a20bc..fc39004 100644
--- a/core/java/android/util/LocaleList.java
+++ b/core/java/android/util/LocaleList.java
@@ -47,12 +47,7 @@
private static final LocaleList sEmptyLocaleList = new LocaleList();
public Locale get(int location) {
- return location < mList.length ? mList[location] : null;
- }
-
- @Nullable
- public Locale getPrimary() {
- return mList.length == 0 ? null : get(0);
+ return (0 <= location && location < mList.length) ? mList[location] : null;
}
public boolean isEmpty() {
@@ -464,7 +459,7 @@
// someone has called Locale.setDefault() since we last set or adjusted the default
// locale list. So let's recalculate the locale list.
if (sDefaultLocaleList != null
- && defaultLocale.equals(sDefaultLocaleList.getPrimary())) {
+ && defaultLocale.equals(sDefaultLocaleList.get(0))) {
// The default Locale has changed, but it happens to be the first locale in the
// default locale list, so we don't need to construct a new locale list.
return sDefaultLocaleList;
diff --git a/core/java/android/util/PathParser.java b/core/java/android/util/PathParser.java
index 29a72fd..78d5bcd 100644
--- a/core/java/android/util/PathParser.java
+++ b/core/java/android/util/PathParser.java
@@ -104,7 +104,6 @@
}
super.finalize();
}
-
}
/**
diff --git a/core/java/android/view/RenderNode.java b/core/java/android/view/RenderNode.java
index 2aace0f..3122c0b 100644
--- a/core/java/android/view/RenderNode.java
+++ b/core/java/android/view/RenderNode.java
@@ -22,7 +22,6 @@
import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.Rect;
-import android.graphics.drawable.AnimatedVectorDrawable;
/**
* <p>A display list records a series of graphics related operations and can replay
@@ -136,6 +135,9 @@
private RenderNode(String name, View owningView) {
mNativeRenderNode = nCreate(name);
mOwningView = owningView;
+ if (mOwningView instanceof SurfaceView) {
+ nRequestPositionUpdates(mNativeRenderNode, (SurfaceView) mOwningView);
+ }
}
/**
@@ -772,14 +774,6 @@
mOwningView.mAttachInfo.mViewRootImpl.registerAnimatingRenderNode(this);
}
- public void addAnimator(AnimatedVectorDrawable.VectorDrawableAnimator animatorSet) {
- if (mOwningView == null || mOwningView.mAttachInfo == null) {
- throw new IllegalStateException("Cannot start this animator on a detached view!");
- }
- nAddAnimator(mNativeRenderNode, animatorSet.getAnimatorNativePtr());
- mOwningView.mAttachInfo.mViewRootImpl.registerAnimatingRenderNode(this);
- }
-
public void endAllAnimators() {
nEndAllAnimators(mNativeRenderNode);
}
@@ -863,6 +857,8 @@
private static native void nOutput(long renderNode);
private static native int nGetDebugSize(long renderNode);
+ private static native void nRequestPositionUpdates(long renderNode, SurfaceView callback);
+
///////////////////////////////////////////////////////////////////////////
// Animations
///////////////////////////////////////////////////////////////////////////
diff --git a/core/java/android/view/RenderNodeAnimatorSetHelper.java b/core/java/android/view/RenderNodeAnimatorSetHelper.java
deleted file mode 100644
index ba592d29..0000000
--- a/core/java/android/view/RenderNodeAnimatorSetHelper.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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 android.view;
-
-import android.animation.TimeInterpolator;
-import com.android.internal.view.animation.FallbackLUTInterpolator;
-import com.android.internal.view.animation.NativeInterpolatorFactory;
-import com.android.internal.view.animation.NativeInterpolatorFactoryHelper;
-
-/**
- * This is a helper class to get access to methods and fields needed for RenderNodeAnimatorSet
- * that are internal or package private to android.view package.
- *
- * @hide
- */
-public class RenderNodeAnimatorSetHelper {
-
- public static RenderNode getTarget(DisplayListCanvas recordingCanvas) {
- return recordingCanvas.mNode;
- }
-
- public static long createNativeInterpolator(TimeInterpolator interpolator, long
- duration) {
- if (interpolator == null) {
- // create LinearInterpolator
- return NativeInterpolatorFactoryHelper.createLinearInterpolator();
- } else if (RenderNodeAnimator.isNativeInterpolator(interpolator)) {
- return ((NativeInterpolatorFactory)interpolator).createNativeInterpolator();
- } else {
- return FallbackLUTInterpolator.createNativeInterpolator(interpolator, duration);
- }
- }
-
-}
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index 5b48e28..a296051 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -135,7 +135,7 @@
}
};
- final ViewTreeObserver.OnScrollChangedListener mScrollChangedListener
+ private final ViewTreeObserver.OnScrollChangedListener mScrollChangedListener
= new ViewTreeObserver.OnScrollChangedListener() {
@Override
public void onScrollChanged() {
@@ -143,6 +143,17 @@
}
};
+ private final ViewTreeObserver.OnPreDrawListener mDrawListener =
+ new ViewTreeObserver.OnPreDrawListener() {
+ @Override
+ public boolean onPreDraw() {
+ // reposition ourselves where the surface is
+ mHaveFrame = getWidth() > 0 && getHeight() > 0;
+ updateWindow(false, false);
+ return true;
+ }
+ };
+
boolean mRequestedVisible = false;
boolean mWindowVisibility = false;
boolean mViewVisibility = false;
@@ -168,17 +179,9 @@
boolean mUpdateWindowNeeded;
boolean mReportDrawNeeded;
private Translator mTranslator;
+ private int mWindowInsetLeft;
+ private int mWindowInsetTop;
- private final ViewTreeObserver.OnPreDrawListener mDrawListener =
- new ViewTreeObserver.OnPreDrawListener() {
- @Override
- public boolean onPreDraw() {
- // reposition ourselves where the surface is
- mHaveFrame = getWidth() > 0 && getHeight() > 0;
- updateWindow(false, false);
- return true;
- }
- };
private boolean mGlobalListenersAdded;
public SurfaceView(Context context) {
@@ -443,17 +446,17 @@
int myHeight = mRequestedHeight;
if (myHeight <= 0) myHeight = getHeight();
- getLocationInWindow(mLocation);
final boolean creating = mWindow == null;
final boolean formatChanged = mFormat != mRequestedFormat;
final boolean sizeChanged = mWindowSpaceWidth != myWidth || mWindowSpaceHeight != myHeight;
final boolean visibleChanged = mVisible != mRequestedVisible;
final boolean layoutSizeChanged = getWidth() != mLayout.width
|| getHeight() != mLayout.height;
- final boolean positionChanged = mWindowSpaceLeft != mLocation[0] || mWindowSpaceTop != mLocation[1];
if (force || creating || formatChanged || sizeChanged || visibleChanged
|| mUpdateWindowNeeded || mReportDrawNeeded || redrawNeeded) {
+ getLocationInWindow(mLocation);
+
if (DEBUG) Log.i(TAG, "Changes: creating=" + creating
+ " format=" + formatChanged + " size=" + sizeChanged
+ " visible=" + visibleChanged
@@ -643,27 +646,69 @@
TAG, "Layout: x=" + mLayout.x + " y=" + mLayout.y +
" w=" + mLayout.width + " h=" + mLayout.height +
", frame=" + mSurfaceFrame);
- } else if (positionChanged || layoutSizeChanged) { // Only the position has changed
- mWindowSpaceLeft = mLocation[0];
- mWindowSpaceTop = mLocation[1];
- // For our size changed check, we keep mLayout.width and mLayout.height
- // in view local space.
- mLocation[0] = mLayout.width = getWidth();
- mLocation[1] = mLayout.height = getHeight();
+ } else if (!isHardwareAccelerated()) {
+ getLocationInWindow(mLocation);
+ final boolean positionChanged = mWindowSpaceLeft != mLocation[0]
+ || mWindowSpaceTop != mLocation[1];
+ if (positionChanged || layoutSizeChanged) { // Only the position has changed
+ mWindowSpaceLeft = mLocation[0];
+ mWindowSpaceTop = mLocation[1];
+ // For our size changed check, we keep mLayout.width and mLayout.height
+ // in view local space.
+ mLocation[0] = mLayout.width = getWidth();
+ mLocation[1] = mLayout.height = getHeight();
- transformFromViewToWindowSpace(mLocation);
+ transformFromViewToWindowSpace(mLocation);
- try {
- mSession.repositionChild(mWindow, mWindowSpaceLeft, mWindowSpaceTop,
- mLocation[0], mLocation[1],
- viewRoot != null ? viewRoot.getNextFrameNumber() : -1,
- mWinFrame);
- } catch (RemoteException ex) {
- Log.e(TAG, "Exception from relayout", ex);
+ try {
+ Log.d(TAG, String.format("updateWindowPosition UI, " +
+ "postion = [%d, %d, %d, %d]", mWindowSpaceLeft, mWindowSpaceTop,
+ mLocation[0], mLocation[1]));
+ mSession.repositionChild(mWindow, mWindowSpaceLeft, mWindowSpaceTop,
+ mLocation[0], mLocation[1], -1, mWinFrame);
+ } catch (RemoteException ex) {
+ Log.e(TAG, "Exception from relayout", ex);
+ }
}
}
}
+ private Rect mRTLastReportedPosition = new Rect();
+
+ /**
+ * Called by native on RenderThread to update the window position
+ * @hide
+ */
+ public final void updateWindowPositionRT(long frameNumber,
+ int left, int top, int right, int bottom) {
+ IWindowSession session = mSession;
+ MyWindow window = mWindow;
+ if (session == null || window == null) {
+ // Guess we got detached, that sucks
+ return;
+ }
+ if (mRTLastReportedPosition.left == left
+ && mRTLastReportedPosition.top == top
+ && mRTLastReportedPosition.right == right
+ && mRTLastReportedPosition.bottom == bottom) {
+ return;
+ }
+ try {
+ if (DEBUG) {
+ Log.d(TAG, String.format("updateWindowPosition RT, frameNr = %d, " +
+ "postion = [%d, %d, %d, %d]", frameNumber, left, top,
+ right, bottom));
+ }
+ // Just using mRTLastReportedPosition as a dummy rect here
+ session.repositionChild(window, left, top, right, bottom, frameNumber,
+ mRTLastReportedPosition);
+ // Now overwrite mRTLastReportedPosition with our values
+ mRTLastReportedPosition.set(left, top, right, bottom);
+ } catch (RemoteException ex) {
+ Log.e(TAG, "Exception from repositionChild", ex);
+ }
+ }
+
private SurfaceHolder.Callback[] getSurfaceCallbacks() {
SurfaceHolder.Callback callbacks[];
synchronized (mCallbacks) {
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 4a0a0b0..127157b 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -4506,9 +4506,15 @@
}
break;
case R.styleable.View_pointerShape:
- final int pointerShape = a.getInt(attr, PointerIcon.STYLE_NOT_SPECIFIED);
- if (pointerShape != PointerIcon.STYLE_NOT_SPECIFIED) {
- setPointerIcon(PointerIcon.getSystemIcon(context, pointerShape));
+ final int resourceId = a.getResourceId(attr, 0);
+ if (resourceId != 0) {
+ setPointerIcon(PointerIcon.loadCustomIcon(
+ context.getResources(), resourceId));
+ } else {
+ final int pointerShape = a.getInt(attr, PointerIcon.STYLE_NOT_SPECIFIED);
+ if (pointerShape != PointerIcon.STYLE_NOT_SPECIFIED) {
+ setPointerIcon(PointerIcon.getSystemIcon(context, pointerShape));
+ }
}
break;
}
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 98e3289..96853e0 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -1811,7 +1811,9 @@
final boolean dragResizing = freeformResizing || dockedResizing;
if (mDragResizing != dragResizing) {
if (dragResizing) {
- startDragResizing(mPendingBackDropFrame);
+ startDragResizing(mPendingBackDropFrame,
+ mWinFrame.equals(mPendingBackDropFrame), mPendingVisibleInsets,
+ mPendingStableInsets);
mResizeMode = freeformResizing
? RESIZE_MODE_FREEFORM
: RESIZE_MODE_DOCKED_DIVIDER;
@@ -5845,9 +5847,11 @@
// Tell all listeners that we are resizing the window so that the chrome can get
// updated as fast as possible on a separate thread,
if (mDragResizing) {
+ boolean fullscreen = frame.equals(backDropFrame);
synchronized (mWindowCallbacks) {
for (int i = mWindowCallbacks.size() - 1; i >= 0; i--) {
- mWindowCallbacks.get(i).onWindowSizeIsChanging(backDropFrame);
+ mWindowCallbacks.get(i).onWindowSizeIsChanging(backDropFrame, fullscreen,
+ visibleInsets, stableInsets);
}
}
}
@@ -6815,20 +6819,6 @@
}
}
- long getNextFrameNumber() {
- long frameNumber = -1;
- if (mSurfaceHolder != null) {
- mSurfaceHolder.mSurfaceLock.lock();
- }
- if (mSurface.isValid()) {
- frameNumber = mSurface.getNextFrameNumber();
- }
- if (mSurfaceHolder != null) {
- mSurfaceHolder.mSurfaceLock.unlock();
- }
- return frameNumber;
- }
-
class TakenSurfaceHolder extends BaseSurfaceHolder {
@Override
public boolean onAllowLockCanvas() {
@@ -7060,12 +7050,14 @@
/**
* Start a drag resizing which will inform all listeners that a window resize is taking place.
*/
- private void startDragResizing(Rect initialBounds) {
+ private void startDragResizing(Rect initialBounds, boolean fullscreen, Rect systemInsets,
+ Rect stableInsets) {
if (!mDragResizing) {
mDragResizing = true;
synchronized (mWindowCallbacks) {
for (int i = mWindowCallbacks.size() - 1; i >= 0; i--) {
- mWindowCallbacks.get(i).onWindowDragResizeStart(initialBounds);
+ mWindowCallbacks.get(i).onWindowDragResizeStart(initialBounds, fullscreen,
+ systemInsets, stableInsets);
}
}
mFullRedrawNeeded = true;
diff --git a/core/java/android/view/WindowCallbacks.java b/core/java/android/view/WindowCallbacks.java
index def02365..d2bfca7 100644
--- a/core/java/android/view/WindowCallbacks.java
+++ b/core/java/android/view/WindowCallbacks.java
@@ -28,20 +28,30 @@
public interface WindowCallbacks {
/**
* Called by the system when the window got changed by the user, before the layouter got called.
- * It can be used to perform a "quick and dirty" resize which should never take more then 4ms to
- * complete.
+ * It also gets called when the insets changed, or when the window switched between a fullscreen
+ * layout or a non-fullscreen layout. It can be used to perform a "quick and dirty" resize which
+ * should never take more then 4ms to complete.
*
* <p>At the time the layouting has not happened yet.
*
* @param newBounds The new window frame bounds.
+ * @param fullscreen Whether the window is currently drawing in fullscreen.
+ * @param systemInsets The current visible system insets for the window.
+ * @param stableInsets The stable insets for the window.
*/
- void onWindowSizeIsChanging(Rect newBounds);
+ void onWindowSizeIsChanging(Rect newBounds, boolean fullscreen, Rect systemInsets,
+ Rect stableInsets);
/**
* Called when a drag resize starts.
+ *
* @param initialBounds The initial bounds where the window will be.
+ * @param fullscreen Whether the window is currently drawing in fullscreen.
+ * @param systemInsets The current visible system insets for the window.
+ * @param stableInsets The stable insets for the window.
*/
- void onWindowDragResizeStart(Rect initialBounds);
+ void onWindowDragResizeStart(Rect initialBounds, boolean fullscreen, Rect systemInsets,
+ Rect stableInsets);
/**
* Called when a drag resize ends.
diff --git a/core/java/android/view/WindowManagerInternal.java b/core/java/android/view/WindowManagerInternal.java
index 89b1eb9..c22d60d 100644
--- a/core/java/android/view/WindowManagerInternal.java
+++ b/core/java/android/view/WindowManagerInternal.java
@@ -268,4 +268,9 @@
/** Returns true if the stack with the input Id is currently visible. */
public abstract boolean isStackVisible(int stackId);
+
+ /**
+ * @return True if and only if the docked divider is currently in resize mode.
+ */
+ public abstract boolean isDockedDividerResizing();
}
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index cf13a13..b0fb93b 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -761,6 +761,7 @@
public static final int TARGET_STANDARD = 2;
private static final int MAX_SERVICE_TARGETS = 8;
+ private static final int MAX_TARGETS_PER_SERVICE = 4;
private final List<ChooserTargetInfo> mServiceTargets = new ArrayList<>();
private final List<TargetInfo> mCallerTargets = new ArrayList<>();
@@ -925,7 +926,7 @@
final float parentScore = getScore(origTarget);
Collections.sort(targets, mBaseTargetComparator);
float lastScore = 0;
- for (int i = 0, N = targets.size(); i < N; i++) {
+ for (int i = 0, N = Math.min(targets.size(), MAX_TARGETS_PER_SERVICE); i < N; i++) {
final ChooserTarget target = targets.get(i);
float targetScore = target.getScore();
targetScore *= parentScore;
diff --git a/core/java/com/android/internal/app/ResolverComparator.java b/core/java/com/android/internal/app/ResolverComparator.java
index 0ae21c6..03a3a38 100644
--- a/core/java/com/android/internal/app/ResolverComparator.java
+++ b/core/java/com/android/internal/app/ResolverComparator.java
@@ -52,7 +52,7 @@
private static final long RECENCY_TIME_PERIOD = 1000 * 60 * 60 * 12;
- private static final float RECENCY_MULTIPLIER = 3.f;
+ private static final float RECENCY_MULTIPLIER = 2.f;
private final Collator mCollator;
private final boolean mHttp;
diff --git a/core/java/com/android/internal/policy/BackdropFrameRenderer.java b/core/java/com/android/internal/policy/BackdropFrameRenderer.java
index 5047c4c..6931193 100644
--- a/core/java/com/android/internal/policy/BackdropFrameRenderer.java
+++ b/core/java/com/android/internal/policy/BackdropFrameRenderer.java
@@ -24,7 +24,6 @@
import android.view.DisplayListCanvas;
import android.view.RenderNode;
import android.view.ThreadedRenderer;
-import android.view.View;
/**
* The thread which draws a fill in background while the app is resizing in areas where the app
@@ -49,6 +48,7 @@
private final Rect mOldTargetRect = new Rect();
private final Rect mNewTargetRect = new Rect();
+
private Choreographer mChoreographer;
// Cached size values from the last render for the case that the view hierarchy is gone
@@ -66,15 +66,23 @@
private Drawable mUserCaptionBackgroundDrawable;
private Drawable mResizingBackgroundDrawable;
private ColorDrawable mStatusBarColor;
+ private ColorDrawable mNavigationBarColor;
+ private boolean mOldFullscreen;
+ private boolean mFullscreen;
+ private final Rect mOldSystemInsets = new Rect();
+ private final Rect mOldStableInsets = new Rect();
+ private final Rect mSystemInsets = new Rect();
+ private final Rect mStableInsets = new Rect();
public BackdropFrameRenderer(DecorView decorView, ThreadedRenderer renderer, Rect initialBounds,
Drawable resizingBackgroundDrawable, Drawable captionBackgroundDrawable,
- Drawable userCaptionBackgroundDrawable, int statusBarColor) {
+ Drawable userCaptionBackgroundDrawable, int statusBarColor, int navigationBarColor,
+ boolean fullscreen, Rect systemInsets, Rect stableInsets) {
setName("ResizeFrame");
mRenderer = renderer;
onResourcesLoaded(decorView, resizingBackgroundDrawable, captionBackgroundDrawable,
- userCaptionBackgroundDrawable, statusBarColor);
+ userCaptionBackgroundDrawable, statusBarColor, navigationBarColor);
// Create a render node for the content and frame backdrop
// which can be resized independently from the content.
@@ -84,8 +92,14 @@
// Set the initial bounds and draw once so that we do not get a broken frame.
mTargetRect.set(initialBounds);
+ mFullscreen = fullscreen;
+ mOldFullscreen = fullscreen;
+ mSystemInsets.set(systemInsets);
+ mStableInsets.set(stableInsets);
+ mOldSystemInsets.set(systemInsets);
+ mOldStableInsets.set(stableInsets);
synchronized (this) {
- changeWindowSizeLocked(initialBounds);
+ redrawLocked(initialBounds, fullscreen, mSystemInsets, mStableInsets);
}
// Kick off our draw thread.
@@ -94,7 +108,7 @@
void onResourcesLoaded(DecorView decorView, Drawable resizingBackgroundDrawable,
Drawable captionBackgroundDrawableDrawable, Drawable userCaptionBackgroundDrawable,
- int statusBarColor) {
+ int statusBarColor, int navigationBarColor) {
mDecorView = decorView;
mResizingBackgroundDrawable = resizingBackgroundDrawable;
mCaptionBackgroundDrawable = captionBackgroundDrawableDrawable;
@@ -108,6 +122,12 @@
} else {
mStatusBarColor = null;
}
+ if (navigationBarColor != 0) {
+ mNavigationBarColor = new ColorDrawable(navigationBarColor);
+ addSystemBarNodeIfNeeded();
+ } else {
+ mNavigationBarColor = null;
+ }
}
private void addSystemBarNodeIfNeeded() {
@@ -119,13 +139,22 @@
}
/**
- * Call this function asynchronously when the window size has been changed. The change will
- * be picked up once per frame and the frame will be re-rendered accordingly.
+ * Call this function asynchronously when the window size has been changed or when the insets
+ * have changed or whether window switched between a fullscreen or non-fullscreen layout.
+ * The change will be picked up once per frame and the frame will be re-rendered accordingly.
+ *
* @param newTargetBounds The new target bounds.
+ * @param fullscreen Whether the window is currently drawing in fullscreen.
+ * @param systemInsets The current visible system insets for the window.
+ * @param stableInsets The stable insets for the window.
*/
- public void setTargetRect(Rect newTargetBounds) {
+ public void setTargetRect(Rect newTargetBounds, boolean fullscreen, Rect systemInsets,
+ Rect stableInsets) {
synchronized (this) {
+ mFullscreen = fullscreen;
mTargetRect.set(newTargetBounds);
+ mSystemInsets.set(systemInsets);
+ mStableInsets.set(stableInsets);
// Notify of a bounds change.
pingRenderLocked();
}
@@ -204,16 +233,23 @@
return;
}
mNewTargetRect.set(mTargetRect);
- if (!mNewTargetRect.equals(mOldTargetRect) || mReportNextDraw) {
+ if (!mNewTargetRect.equals(mOldTargetRect)
+ || mOldFullscreen != mFullscreen
+ || !mStableInsets.equals(mOldStableInsets)
+ || !mSystemInsets.equals(mOldSystemInsets)
+ || mReportNextDraw) {
+ mOldFullscreen = mFullscreen;
mOldTargetRect.set(mNewTargetRect);
- changeWindowSizeLocked(mNewTargetRect);
+ mOldSystemInsets.set(mSystemInsets);
+ mOldStableInsets.set(mStableInsets);
+ redrawLocked(mNewTargetRect, mFullscreen, mSystemInsets, mStableInsets);
}
}
}
/**
* The content is about to be drawn and we got the location of where it will be shown.
- * If a "changeWindowSizeLocked" call has already been processed, we will re-issue the call
+ * If a "redrawLocked" call has already been processed, we will re-issue the call
* if the previous call was ignored since the size was unknown.
* @param xOffset The x offset where the content is drawn to.
* @param yOffset The y offset where the content is drawn to.
@@ -235,8 +271,8 @@
mLastYOffset,
mLastXOffset + mLastContentWidth,
mLastYOffset + mLastCaptionHeight + mLastContentHeight);
- // If this was the first call and changeWindowSizeLocked got already called prior
- // to us, we should re-issue a changeWindowSizeLocked now.
+ // If this was the first call and redrawLocked got already called prior
+ // to us, we should re-issue a redrawLocked now.
return firstCall
&& (mLastCaptionHeight != 0 || !mDecorView.isShowingCaption());
}
@@ -251,16 +287,20 @@
}
/**
- * Resizing the frame to fit the new window size.
+ * Redraws the background, the caption and the system inset backgrounds if something changed.
+ *
* @param newBounds The window bounds which needs to be drawn.
+ * @param fullscreen Whether the window is currently drawing in fullscreen.
+ * @param systemInsets The current visible system insets for the window.
+ * @param stableInsets The stable insets for the window.
*/
- private void changeWindowSizeLocked(Rect newBounds) {
+ private void redrawLocked(Rect newBounds, boolean fullscreen, Rect systemInsets,
+ Rect stableInsets) {
// While a configuration change is taking place the view hierarchy might become
// inaccessible. For that case we remember the previous metrics to avoid flashes.
// Note that even when there is no visible caption, the caption child will exist.
final int captionHeight = mDecorView.getCaptionHeight();
- final int statusBarHeight = mDecorView.getStatusBarHeight();
// The caption height will probably never dynamically change while we are resizing.
// Once set to something other then 0 it should be kept that way.
@@ -302,14 +342,7 @@
}
mFrameAndBackdropNode.end(canvas);
- if (mSystemBarBackgroundNode != null && mStatusBarColor != null) {
- canvas = mSystemBarBackgroundNode.start(width, height);
- mSystemBarBackgroundNode.setLeftTopRightBottom(left, top, left + width, top + height);
- mStatusBarColor.setBounds(0, 0, left + width, statusBarHeight);
- mStatusBarColor.draw(canvas);
- mSystemBarBackgroundNode.end(canvas);
- mRenderer.drawRenderNode(mSystemBarBackgroundNode);
- }
+ drawColorViews(left, top, width, height, fullscreen, systemInsets, stableInsets);
// We need to render the node explicitly
mRenderer.drawRenderNode(mFrameAndBackdropNode);
@@ -317,6 +350,39 @@
reportDrawIfNeeded();
}
+ private void drawColorViews(int left, int top, int width, int height,
+ boolean fullscreen, Rect systemInsets, Rect stableInsets) {
+ if (mSystemBarBackgroundNode == null) {
+ return;
+ }
+ DisplayListCanvas canvas = mSystemBarBackgroundNode.start(width, height);
+ mSystemBarBackgroundNode.setLeftTopRightBottom(left, top, left + width, top + height);
+ final int topInset = DecorView.getColorViewTopInset(mStableInsets.top, mSystemInsets.top);
+ final int bottomInset = DecorView.getColorViewBottomInset(stableInsets.bottom,
+ systemInsets.bottom);
+ final int rightInset = DecorView.getColorViewRightInset(stableInsets.right,
+ systemInsets.right);
+ if (mStatusBarColor != null) {
+ mStatusBarColor.setBounds(0, 0, left + width, topInset);
+ mStatusBarColor.draw(canvas);
+ }
+
+ // We only want to draw the navigation bar if our window is currently fullscreen because we
+ // don't want the navigation bar background be moving around when resizing in docked mode.
+ // However, we need it for the transitions into/out of docked mode.
+ if (mNavigationBarColor != null && fullscreen) {
+ final int size = DecorView.getNavBarSize(bottomInset, rightInset);
+ if (DecorView.isNavBarToRightEdge(bottomInset, rightInset)) {
+ mNavigationBarColor.setBounds(width - size, 0, width, height);
+ } else {
+ mNavigationBarColor.setBounds(0, height - size, width, height);
+ }
+ mNavigationBarColor.draw(canvas);
+ }
+ mSystemBarBackgroundNode.end(canvas);
+ mRenderer.drawRenderNode(mSystemBarBackgroundNode);
+ }
+
/** Notify view root that a frame has been drawn by us, if it has requested so. */
private void reportDrawIfNeeded() {
if (mReportNextDraw) {
diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java
index 1a20e5c..d4ada95 100644
--- a/core/java/com/android/internal/policy/DecorView.java
+++ b/core/java/com/android/internal/policy/DecorView.java
@@ -922,6 +922,26 @@
return false;
}
+ static int getColorViewTopInset(int stableTop, int systemTop) {
+ return Math.min(stableTop, systemTop);
+ }
+
+ static int getColorViewBottomInset(int stableBottom, int systemBottom) {
+ return Math.min(stableBottom, systemBottom);
+ }
+
+ static int getColorViewRightInset(int stableRight, int systemRight) {
+ return Math.min(stableRight, systemRight);
+ }
+
+ static boolean isNavBarToRightEdge(int bottomInset, int rightInset) {
+ return bottomInset == 0 && rightInset > 0;
+ }
+
+ static int getNavBarSize(int bottomInset, int rightInset) {
+ return isNavBarToRightEdge(bottomInset, rightInset) ? rightInset : bottomInset;
+ }
+
WindowInsets updateColorViews(WindowInsets insets, boolean animate) {
WindowManager.LayoutParams attrs = mWindow.getAttributes();
int sysUiVisibility = attrs.systemUiVisibility | getWindowSystemUiVisibility();
@@ -933,11 +953,11 @@
mLastWindowFlags = attrs.flags;
if (insets != null) {
- mLastTopInset = Math.min(insets.getStableInsetTop(),
+ mLastTopInset = getColorViewTopInset(insets.getStableInsetTop(),
insets.getSystemWindowInsetTop());
- mLastBottomInset = Math.min(insets.getStableInsetBottom(),
+ mLastBottomInset = getColorViewBottomInset(insets.getStableInsetBottom(),
insets.getSystemWindowInsetBottom());
- mLastRightInset = Math.min(insets.getStableInsetRight(),
+ mLastRightInset = getColorViewRightInset(insets.getStableInsetRight(),
insets.getSystemWindowInsetRight());
// Don't animate if the presence of stable insets has changed, because that
@@ -956,8 +976,8 @@
mLastHasRightStableInset = hasRightStableInset;
}
- boolean navBarToRightEdge = mLastBottomInset == 0 && mLastRightInset > 0;
- int navBarSize = navBarToRightEdge ? mLastRightInset : mLastBottomInset;
+ boolean navBarToRightEdge = isNavBarToRightEdge(mLastBottomInset, mLastRightInset);
+ int navBarSize = getNavBarSize(mLastBottomInset, mLastRightInset);
updateColorViewInt(mNavigationColorViewState, sysUiVisibility,
mWindow.mNavigationBarColor, navBarSize, navBarToRightEdge,
0 /* rightInset */, animate && !disallowAnimate, false /* force */);
@@ -1041,14 +1061,14 @@
*/
private void updateColorViewInt(final ColorViewState state, int sysUiVis, int color,
int size, boolean verticalBar, int rightMargin, boolean animate, boolean force) {
- state.present = size > 0 && (sysUiVis & state.systemUiHideFlag) == 0
+ state.present = (sysUiVis & state.systemUiHideFlag) == 0
&& (mWindow.getAttributes().flags & state.hideWindowFlag) == 0
&& ((mWindow.getAttributes().flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0
|| force);
boolean show = state.present
&& (color & Color.BLACK) != 0
&& ((mWindow.getAttributes().flags & state.translucentFlag) == 0 || force);
- boolean showView = show && !isResizing();
+ boolean showView = show && !isResizing() && size > 0;
boolean visibilityChanged = false;
View view = state.view;
@@ -1672,7 +1692,8 @@
loadBackgroundDrawablesIfNeeded();
mBackdropFrameRenderer.onResourcesLoaded(
this, mResizingBackgroundDrawable, mCaptionBackgroundDrawable,
- mUserCaptionBackgroundDrawable, getCurrentColor(mStatusColorViewState));
+ mUserCaptionBackgroundDrawable, getCurrentColor(mStatusColorViewState),
+ getCurrentColor(mNavigationColorViewState));
}
mDecorCaptionView = createDecorCaptionView(inflater);
@@ -1854,14 +1875,16 @@
}
@Override
- public void onWindowSizeIsChanging(Rect newBounds) {
+ public void onWindowSizeIsChanging(Rect newBounds, boolean fullscreen, Rect systemInsets,
+ Rect stableInsets) {
if (mBackdropFrameRenderer != null) {
- mBackdropFrameRenderer.setTargetRect(newBounds);
+ mBackdropFrameRenderer.setTargetRect(newBounds, fullscreen, systemInsets, stableInsets);
}
}
@Override
- public void onWindowDragResizeStart(Rect initialBounds) {
+ public void onWindowDragResizeStart(Rect initialBounds, boolean fullscreen, Rect systemInsets,
+ Rect stableInsets) {
if (mWindow.isDestroyed()) {
// If the owner's window is gone, we should not be able to come here anymore.
releaseThreadedRenderer();
@@ -1875,7 +1898,9 @@
loadBackgroundDrawablesIfNeeded();
mBackdropFrameRenderer = new BackdropFrameRenderer(this, renderer,
initialBounds, mResizingBackgroundDrawable, mCaptionBackgroundDrawable,
- mUserCaptionBackgroundDrawable, getCurrentColor(mStatusColorViewState));
+ mUserCaptionBackgroundDrawable, getCurrentColor(mStatusColorViewState),
+ getCurrentColor(mNavigationColorViewState), fullscreen, systemInsets,
+ stableInsets);
// Get rid of the shadow while we are resizing. Shadow drawing takes considerable time.
// If we want to get the shadow shown while resizing, we would need to elevate a new
@@ -1971,10 +1996,6 @@
return isShowingCaption() ? mDecorCaptionView.getCaptionHeight() : 0;
}
- int getStatusBarHeight() {
- return mStatusColorViewState.view != null ? mStatusColorViewState.view.getHeight() : 0;
- }
-
/**
* Converts a DIP measure into physical pixels.
* @param dip The dip value.
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index 1b6b53a..ffa3fa6 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -51,7 +51,6 @@
android_database_SQLiteConnection.cpp \
android_database_SQLiteGlobal.cpp \
android_database_SQLiteDebug.cpp \
- android_graphics_drawable_AnimatedVectorDrawable.cpp \
android_graphics_drawable_VectorDrawable.cpp \
android_view_DisplayEventReceiver.cpp \
android_view_DisplayListCanvas.cpp \
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 223fc1a..2e45f8c 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -131,7 +131,6 @@
extern int register_android_graphics_Region(JNIEnv* env);
extern int register_android_graphics_SurfaceTexture(JNIEnv* env);
extern int register_android_graphics_Xfermode(JNIEnv* env);
-extern int register_android_graphics_drawable_AnimatedVectorDrawable(JNIEnv* env);
extern int register_android_graphics_drawable_VectorDrawable(JNIEnv* env);
extern int register_android_graphics_pdf_PdfDocument(JNIEnv* env);
extern int register_android_graphics_pdf_PdfEditor(JNIEnv* env);
@@ -1322,7 +1321,6 @@
REG_JNI(register_android_graphics_Typeface),
REG_JNI(register_android_graphics_Xfermode),
REG_JNI(register_android_graphics_YuvImage),
- REG_JNI(register_android_graphics_drawable_AnimatedVectorDrawable),
REG_JNI(register_android_graphics_drawable_VectorDrawable),
REG_JNI(register_android_graphics_pdf_PdfDocument),
REG_JNI(register_android_graphics_pdf_PdfEditor),
diff --git a/core/jni/android/graphics/Graphics.cpp b/core/jni/android/graphics/Graphics.cpp
index 3d5091a..bd01c73 100644
--- a/core/jni/android/graphics/Graphics.cpp
+++ b/core/jni/android/graphics/Graphics.cpp
@@ -746,10 +746,12 @@
if (mNeedsCopy) {
SkPixelRef* recycledPixels = mRecycledBitmap->refPixelRef();
void* dst = recycledPixels->pixels();
- size_t dstRowBytes = mRecycledBitmap->rowBytes();
- size_t bytesToCopy = SkTMin(mRecycledBitmap->info().minRowBytes(),
+ const size_t dstRowBytes = mRecycledBitmap->rowBytes();
+ const size_t bytesToCopy = std::min(mRecycledBitmap->info().minRowBytes(),
mSkiaBitmap->info().minRowBytes());
- for (int y = 0; y < mRecycledBitmap->info().height(); y++) {
+ const int rowsToCopy = std::min(mRecycledBitmap->info().height(),
+ mSkiaBitmap->info().height());
+ for (int y = 0; y < rowsToCopy; y++) {
memcpy(dst, mSkiaBitmap->getAddr(0, y), bytesToCopy);
dst = SkTAddOffset<void>(dst, dstRowBytes);
}
diff --git a/core/jni/android_graphics_Canvas.cpp b/core/jni/android_graphics_Canvas.cpp
index 35b5016..cf73316 100644
--- a/core/jni/android_graphics_Canvas.cpp
+++ b/core/jni/android_graphics_Canvas.cpp
@@ -510,7 +510,7 @@
size_t glyphCount = end - start;
- if (CC_UNLIKELY(canvas->isHighContrastText())) {
+ if (CC_UNLIKELY(canvas->isHighContrastText() && paint.getAlpha() != 0)) {
// high contrast draw path
int color = paint.getColor();
int channelSum = SkColorGetR(color) + SkColorGetG(color) + SkColorGetB(color);
diff --git a/core/jni/android_graphics_drawable_AnimatedVectorDrawable.cpp b/core/jni/android_graphics_drawable_AnimatedVectorDrawable.cpp
deleted file mode 100644
index 7a3c598..0000000
--- a/core/jni/android_graphics_drawable_AnimatedVectorDrawable.cpp
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * 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.
- */
-#define LOG_TAG "OpenGLRenderer"
-
-#include "jni.h"
-#include "GraphicsJNI.h"
-#include "core_jni_helpers.h"
-#include "log/log.h"
-
-#include "Animator.h"
-#include "Interpolator.h"
-#include "PropertyValuesAnimatorSet.h"
-#include "PropertyValuesHolder.h"
-#include "VectorDrawable.h"
-
-namespace android {
-using namespace uirenderer;
-using namespace VectorDrawable;
-
-static struct {
- jclass clazz;
- jmethodID callOnFinished;
-} gVectorDrawableAnimatorClassInfo;
-
-static JNIEnv* getEnv(JavaVM* vm) {
- JNIEnv* env;
- if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
- return 0;
- }
- return env;
-}
-
-static AnimationListener* createAnimationListener(JNIEnv* env, jobject finishListener) {
- class AnimationListenerBridge : public AnimationListener {
- public:
- AnimationListenerBridge(JNIEnv* env, jobject finishListener) {
- mFinishListener = env->NewGlobalRef(finishListener);
- env->GetJavaVM(&mJvm);
- }
-
- virtual ~AnimationListenerBridge() {
- if (mFinishListener) {
- onAnimationFinished(NULL);
- }
- }
-
- virtual void onAnimationFinished(BaseRenderNodeAnimator*) {
- LOG_ALWAYS_FATAL_IF(!mFinishListener, "Finished listener twice?");
- JNIEnv* env = getEnv(mJvm);
- env->CallStaticVoidMethod(
- gVectorDrawableAnimatorClassInfo.clazz,
- gVectorDrawableAnimatorClassInfo.callOnFinished,
- mFinishListener);
- releaseJavaObject();
- }
-
- private:
- void releaseJavaObject() {
- JNIEnv* env = getEnv(mJvm);
- env->DeleteGlobalRef(mFinishListener);
- mFinishListener = NULL;
- }
-
- JavaVM* mJvm;
- jobject mFinishListener;
- };
- return new AnimationListenerBridge(env, finishListener);
-}
-
-static void addAnimator(JNIEnv*, jobject, jlong animatorSetPtr, jlong propertyHolderPtr,
- jlong interpolatorPtr, jlong startDelay, jlong duration, jint repeatCount) {
- PropertyValuesAnimatorSet* set = reinterpret_cast<PropertyValuesAnimatorSet*>(animatorSetPtr);
- PropertyValuesHolder* holder = reinterpret_cast<PropertyValuesHolder*>(propertyHolderPtr);
- Interpolator* interpolator = reinterpret_cast<Interpolator*>(interpolatorPtr);
- set->addPropertyAnimator(holder, interpolator, startDelay, duration, repeatCount);
-}
-
-static jlong createAnimatorSet(JNIEnv*, jobject) {
- PropertyValuesAnimatorSet* animatorSet = new PropertyValuesAnimatorSet();
- return reinterpret_cast<jlong>(animatorSet);
-}
-
-static jlong createGroupPropertyHolder(JNIEnv*, jobject, jlong nativePtr, jint propertyId,
- jfloat startValue, jfloat endValue) {
- VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(nativePtr);
- GroupPropertyValuesHolder* newHolder = new GroupPropertyValuesHolder(group, propertyId,
- startValue, endValue);
- return reinterpret_cast<jlong>(newHolder);
-}
-
-static jlong createPathDataPropertyHolder(JNIEnv*, jobject, jlong nativePtr, jlong startValuePtr,
- jlong endValuePtr) {
- VectorDrawable::Path* path = reinterpret_cast<VectorDrawable::Path*>(nativePtr);
- PathData* startData = reinterpret_cast<PathData*>(startValuePtr);
- PathData* endData = reinterpret_cast<PathData*>(endValuePtr);
- PathDataPropertyValuesHolder* newHolder = new PathDataPropertyValuesHolder(path,
- startData, endData);
- return reinterpret_cast<jlong>(newHolder);
-}
-
-static jlong createPathColorPropertyHolder(JNIEnv*, jobject, jlong nativePtr, jint propertyId,
- int startValue, jint endValue) {
- VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(nativePtr);
- FullPathColorPropertyValuesHolder* newHolder = new FullPathColorPropertyValuesHolder(fullPath,
- propertyId, startValue, endValue);
- return reinterpret_cast<jlong>(newHolder);
-}
-
-static jlong createPathPropertyHolder(JNIEnv*, jobject, jlong nativePtr, jint propertyId,
- float startValue, jfloat endValue) {
- VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(nativePtr);
- FullPathPropertyValuesHolder* newHolder = new FullPathPropertyValuesHolder(fullPath,
- propertyId, startValue, endValue);
- return reinterpret_cast<jlong>(newHolder);
-}
-
-static jlong createRootAlphaPropertyHolder(JNIEnv*, jobject, jlong nativePtr, jfloat startValue,
- float endValue) {
- VectorDrawable::Tree* tree = reinterpret_cast<VectorDrawable::Tree*>(nativePtr);
- RootAlphaPropertyValuesHolder* newHolder = new RootAlphaPropertyValuesHolder(tree,
- startValue, endValue);
- return reinterpret_cast<jlong>(newHolder);
-}
-static void setPropertyHolderData(JNIEnv* env, jobject, jlong propertyHolderPtr,
- jfloatArray srcData, jint length) {
-
- jfloat* propertyData = env->GetFloatArrayElements(srcData, nullptr);
- PropertyValuesHolder* holder = reinterpret_cast<PropertyValuesHolder*>(propertyHolderPtr);
- holder->setPropertyDataSource(propertyData, length);
- env->ReleaseFloatArrayElements(srcData, propertyData, JNI_ABORT);
-}
-static void start(JNIEnv* env, jobject, jlong animatorSetPtr, jobject finishListener) {
- PropertyValuesAnimatorSet* set = reinterpret_cast<PropertyValuesAnimatorSet*>(animatorSetPtr);
- // TODO: keep a ref count in finish listener
- AnimationListener* listener = createAnimationListener(env, finishListener);
- set->start(listener);
-}
-
-static void reverse(JNIEnv* env, jobject, jlong animatorSetPtr, jobject finishListener) {
- // TODO: implement reverse
-}
-
-static void end(JNIEnv*, jobject, jlong animatorSetPtr) {
- PropertyValuesAnimatorSet* set = reinterpret_cast<PropertyValuesAnimatorSet*>(animatorSetPtr);
- set->end();
-}
-
-static void reset(JNIEnv*, jobject, jlong animatorSetPtr) {
- PropertyValuesAnimatorSet* set = reinterpret_cast<PropertyValuesAnimatorSet*>(animatorSetPtr);
- set->reset();
-}
-
-static const JNINativeMethod gMethods[] = {
- {"nCreateAnimatorSet", "()J", (void*)createAnimatorSet},
- {"nAddAnimator", "(JJJJJI)V", (void*)addAnimator},
- {"nCreateGroupPropertyHolder", "!(JIFF)J", (void*)createGroupPropertyHolder},
- {"nCreatePathDataPropertyHolder", "!(JJJ)J", (void*)createPathDataPropertyHolder},
- {"nCreatePathColorPropertyHolder", "!(JIII)J", (void*)createPathColorPropertyHolder},
- {"nCreatePathPropertyHolder", "!(JIFF)J", (void*)createPathPropertyHolder},
- {"nCreateRootAlphaPropertyHolder", "!(JFF)J", (void*)createRootAlphaPropertyHolder},
- {"nSetPropertyHolderData", "(J[FI)V", (void*)setPropertyHolderData},
- {"nStart", "(JLandroid/graphics/drawable/AnimatedVectorDrawable$VectorDrawableAnimator;)V", (void*)start},
- {"nReverse", "(JLandroid/graphics/drawable/AnimatedVectorDrawable$VectorDrawableAnimator;)V", (void*)reverse},
- {"nEnd", "!(J)V", (void*)end},
- {"nReset", "!(J)V", (void*)reset},
-};
-
-const char* const kClassPathName = "android/graphics/drawable/AnimatedVectorDrawable$VectorDrawableAnimator";
-int register_android_graphics_drawable_AnimatedVectorDrawable(JNIEnv* env) {
- gVectorDrawableAnimatorClassInfo.clazz = FindClassOrDie(env, kClassPathName);
- gVectorDrawableAnimatorClassInfo.clazz = MakeGlobalRefOrDie(env,
- gVectorDrawableAnimatorClassInfo.clazz);
-
- gVectorDrawableAnimatorClassInfo.callOnFinished = GetStaticMethodIDOrDie(
- env, gVectorDrawableAnimatorClassInfo.clazz, "callOnFinished",
- "(Landroid/graphics/drawable/AnimatedVectorDrawable$VectorDrawableAnimator;)V");
- return RegisterMethodsOrDie(env, "android/graphics/drawable/AnimatedVectorDrawable",
- gMethods, NELEM(gMethods));
-}
-
-}; // namespace android
diff --git a/core/jni/android_graphics_drawable_VectorDrawable.cpp b/core/jni/android_graphics_drawable_VectorDrawable.cpp
index e882876..563ec8b 100644
--- a/core/jni/android_graphics_drawable_VectorDrawable.cpp
+++ b/core/jni/android_graphics_drawable_VectorDrawable.cpp
@@ -32,6 +32,11 @@
return reinterpret_cast<jlong>(tree);
}
+static void deleteTree(JNIEnv*, jobject, jlong treePtr) {
+ VectorDrawable::Tree* tree = reinterpret_cast<VectorDrawable::Tree*>(treePtr);
+ delete tree;
+}
+
static void setTreeViewportSize(JNIEnv*, jobject, jlong treePtr,
jfloat viewportWidth, jfloat viewportHeight) {
VectorDrawable::Tree* tree = reinterpret_cast<VectorDrawable::Tree*>(treePtr);
@@ -328,6 +333,7 @@
static const JNINativeMethod gMethods[] = {
{"nCreateRenderer", "!(J)J", (void*)createTree},
+ {"nDestroyRenderer", "!(J)V", (void*)deleteTree},
{"nSetRendererViewportSize", "!(JFF)V", (void*)setTreeViewportSize},
{"nSetRootAlpha", "!(JF)Z", (void*)setRootAlpha},
{"nGetRootAlpha", "!(J)F", (void*)getRootAlpha},
diff --git a/core/jni/android_view_RenderNode.cpp b/core/jni/android_view_RenderNode.cpp
index b1d4e26..a9003c1 100644
--- a/core/jni/android_view_RenderNode.cpp
+++ b/core/jni/android_view_RenderNode.cpp
@@ -15,6 +15,7 @@
*/
#define LOG_TAG "OpenGLRenderer"
+#define ATRACE_TAG ATRACE_TAG_VIEW
#include <EGL/egl.h>
@@ -24,7 +25,10 @@
#include <android_runtime/AndroidRuntime.h>
#include <Animator.h>
+#include <DamageAccumulator.h>
+#include <Matrix.h>
#include <RenderNode.h>
+#include <TreeInfo.h>
#include <Paint.h>
#include "core_jni_helpers.h"
@@ -462,6 +466,69 @@
}
// ----------------------------------------------------------------------------
+// SurfaceView position callback
+// ----------------------------------------------------------------------------
+
+jmethodID gSurfaceViewPositionUpdateMethod;
+
+static void android_view_RenderNode_requestPositionUpdates(JNIEnv* env, jobject,
+ jlong renderNodePtr, jobject surfaceview) {
+ class SurfaceViewPositionUpdater : public RenderNode::PositionListener {
+ public:
+ SurfaceViewPositionUpdater(JNIEnv* env, jobject surfaceview) {
+ env->GetJavaVM(&mVm);
+ mWeakRef = env->NewWeakGlobalRef(surfaceview);
+ }
+
+ virtual ~SurfaceViewPositionUpdater() {
+ jnienv()->DeleteWeakGlobalRef(mWeakRef);
+ mWeakRef = nullptr;
+ }
+
+ virtual void onPositionUpdated(RenderNode& node, const TreeInfo& info) override {
+ if (CC_UNLIKELY(!mWeakRef || !info.updateWindowPositions)) return;
+ ATRACE_NAME("Update SurfaceView position");
+
+ JNIEnv* env = jnienv();
+ jobject localref = env->NewLocalRef(mWeakRef);
+ if (CC_UNLIKELY(!localref)) {
+ jnienv()->DeleteWeakGlobalRef(mWeakRef);
+ mWeakRef = nullptr;
+ return;
+ }
+ Matrix4 transform;
+ info.damageAccumulator->computeCurrentTransform(&transform);
+ const RenderProperties& props = node.properties();
+ uirenderer::Rect bounds(props.getWidth(), props.getHeight());
+ transform.mapRect(bounds);
+ bounds.left -= info.windowInsetLeft;
+ bounds.right -= info.windowInsetLeft;
+ bounds.top -= info.windowInsetTop;
+ bounds.bottom -= info.windowInsetTop;
+ env->CallVoidMethod(localref, gSurfaceViewPositionUpdateMethod,
+ (jlong) info.frameNumber, (jint) bounds.left, (jint) bounds.top,
+ (jint) bounds.right, (jint) bounds.bottom);
+ env->DeleteLocalRef(localref);
+ }
+
+ private:
+ JNIEnv* jnienv() {
+ JNIEnv* env;
+ if (mVm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
+ LOG_ALWAYS_FATAL("Failed to get JNIEnv for JavaVM: %p", mVm);
+ }
+ return env;
+ }
+
+ JavaVM* mVm;
+ jobject mWeakRef;
+ };
+
+ RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr);
+ renderNode->setPositionListener(new SurfaceViewPositionUpdater(env, surfaceview));
+}
+
+// ----------------------------------------------------------------------------
// JNI Glue
// ----------------------------------------------------------------------------
@@ -539,9 +606,14 @@
{ "nAddAnimator", "(JJ)V", (void*) android_view_RenderNode_addAnimator },
{ "nEndAllAnimators", "(J)V", (void*) android_view_RenderNode_endAllAnimators },
+
+ { "nRequestPositionUpdates", "(JLandroid/view/SurfaceView;)V", (void*) android_view_RenderNode_requestPositionUpdates },
};
int register_android_view_RenderNode(JNIEnv* env) {
+ jclass clazz = FindClassOrDie(env, "android/view/SurfaceView");
+ gSurfaceViewPositionUpdateMethod = GetMethodIDOrDie(env, clazz,
+ "updateWindowPositionRT", "(JIIII)V");
return RegisterMethodsOrDie(env, kClassPathName, gMethods, NELEM(gMethods));
}
diff --git a/core/jni/android_view_ThreadedRenderer.cpp b/core/jni/android_view_ThreadedRenderer.cpp
index 8c907dd..acd0501 100644
--- a/core/jni/android_view_ThreadedRenderer.cpp
+++ b/core/jni/android_view_ThreadedRenderer.cpp
@@ -134,7 +134,14 @@
virtual void prepareTree(TreeInfo& info) {
info.errorHandler = this;
+ // TODO: This is hacky
+ info.windowInsetLeft = -stagingProperties().getLeft();
+ info.windowInsetTop = -stagingProperties().getTop();
+ info.updateWindowPositions = true;
RenderNode::prepareTree(info);
+ info.updateWindowPositions = false;
+ info.windowInsetLeft = 0;
+ info.windowInsetTop = 0;
info.errorHandler = NULL;
}
@@ -369,28 +376,28 @@
static void android_view_ThreadedRenderer_initialize(JNIEnv* env, jobject clazz,
jlong proxyPtr, jobject jsurface) {
RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr);
- sp<ANativeWindow> window = android_view_Surface_getNativeWindow(env, jsurface);
- proxy->initialize(window);
+ sp<Surface> surface = android_view_Surface_getSurface(env, jsurface);
+ proxy->initialize(surface);
}
static void android_view_ThreadedRenderer_updateSurface(JNIEnv* env, jobject clazz,
jlong proxyPtr, jobject jsurface) {
RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr);
- sp<ANativeWindow> window;
+ sp<Surface> surface;
if (jsurface) {
- window = android_view_Surface_getNativeWindow(env, jsurface);
+ surface = android_view_Surface_getSurface(env, jsurface);
}
- proxy->updateSurface(window);
+ proxy->updateSurface(surface);
}
static jboolean android_view_ThreadedRenderer_pauseSurface(JNIEnv* env, jobject clazz,
jlong proxyPtr, jobject jsurface) {
RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr);
- sp<ANativeWindow> window;
+ sp<Surface> surface;
if (jsurface) {
- window = android_view_Surface_getNativeWindow(env, jsurface);
+ surface = android_view_Surface_getSurface(env, jsurface);
}
- return proxy->pauseSurface(window);
+ return proxy->pauseSurface(surface);
}
static void android_view_ThreadedRenderer_setup(JNIEnv* env, jobject clazz, jlong proxyPtr,
diff --git a/core/res/res/drawable/ic_close.xml b/core/res/res/drawable/ic_close.xml
new file mode 100644
index 0000000..7086959
--- /dev/null
+++ b/core/res/res/drawable/ic_close.xml
@@ -0,0 +1,24 @@
+<!--
+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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24.0dp"
+ android:height="24.0dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:pathData="M19.000000,6.400000l-1.400000,-1.400000 -5.600000,5.600000 -5.600000,-5.600000 -1.400000,1.400000 5.600000,5.600000 -5.600000,5.600000 1.400000,1.400000 5.600000,-5.600000 5.600000,5.600000 1.400000,-1.400000 -5.600000,-5.600000z"
+ android:fillColor="#FF000000"/>
+</vector>
diff --git a/core/res/res/drawable/ic_feedback.xml b/core/res/res/drawable/ic_feedback.xml
new file mode 100644
index 0000000..b2d1cb8
--- /dev/null
+++ b/core/res/res/drawable/ic_feedback.xml
@@ -0,0 +1,27 @@
+<!--
+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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24.0dp"
+ android:height="24.0dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:pathData="M0 0h24v24H0z"
+ android:fillColor="#00000000"/>
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M20.0,2.0L4.0,2.0c-1.1,0.0 -1.9,0.9 -1.99,2.0L2.0,22.0l4.0,-4.0l14.0,0.0c1.1,0.0 2.0,-0.9 2.0,-2.0L22.0,4.0c0.0,-1.1 -0.9,-2.0 -2.0,-2.0zm-7.0,12.0l-2.0,0.0l0.0,-2.0l2.0,0.0l0.0,2.0zm0.0,-4.0l-2.0,0.0L11.0,6.0l2.0,0.0l0.0,4.0z"/>
+</vector>
diff --git a/core/res/res/drawable/ic_refresh.xml b/core/res/res/drawable/ic_refresh.xml
new file mode 100644
index 0000000..1f67168
--- /dev/null
+++ b/core/res/res/drawable/ic_refresh.xml
@@ -0,0 +1,27 @@
+<!--
+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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24.0dp"
+ android:height="24.0dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M17.65,6.35C16.2,4.9 14.21,4.0 12.0,4.0c-4.42,0.0 -7.99,3.58 -7.99,8.0s3.57,8.0 7.99,8.0c3.73,0.0 6.84,-2.55 7.73,-6.0l-2.08,0.0c-0.82,2.33 -3.04,4.0 -5.65,4.0 -3.31,0.0 -6.0,-2.69 -6.0,-6.0s2.69,-6.0 6.0,-6.0c1.66,0.0 3.1,0.69 4.22,1.78L13.0,11.0l7.0,0.0L20.0,4.0l-2.35,2.35z"/>
+ <path
+ android:pathData="M0 0h24v24H0z"
+ android:fillColor="#00000000"/>
+</vector>
diff --git a/core/res/res/drawable/ic_schedule.xml b/core/res/res/drawable/ic_schedule.xml
new file mode 100644
index 0000000..899dc82
--- /dev/null
+++ b/core/res/res/drawable/ic_schedule.xml
@@ -0,0 +1,30 @@
+<!--
+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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24.0dp"
+ android:height="24.0dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M11.99,2.0C6.47,2.0 2.0,6.48 2.0,12.0s4.47,10.0 9.99,10.0C17.52,22.0 22.0,17.52 22.0,12.0S17.52,2.0 11.99,2.0zM12.0,20.0c-4.42,0.0 -8.0,-3.58 -8.0,-8.0s3.58,-8.0 8.0,-8.0 8.0,3.58 8.0,8.0 -3.58,8.0 -8.0,8.0z"/>
+ <path
+ android:pathData="M0 0h24v24H0z"
+ android:fillColor="#00000000"/>
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M12.5,7.0L11.0,7.0l0.0,6.0l5.25,3.1 0.75,-1.23 -4.5,-2.67z"/>
+</vector>
diff --git a/core/res/res/layout/app_anr_dialog.xml b/core/res/res/layout/app_anr_dialog.xml
index e8169ee..8bef116 100644
--- a/core/res/res/layout/app_anr_dialog.xml
+++ b/core/res/res/layout/app_anr_dialog.xml
@@ -18,28 +18,31 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
- android:paddingTop="@dimen/dialog_list_padding_vertical_material"
+ android:paddingTop="@dimen/aerr_padding_list_top"
android:paddingBottom="@dimen/dialog_list_padding_vertical_material">
- <TextView
+ <Button
android:id="@+id/aerr_close"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/aerr_close_app"
+ android:drawableStart="@drawable/ic_close"
style="@style/aerr_list_item" />
- <TextView
+ <Button
android:id="@+id/aerr_wait"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/aerr_wait"
+ android:drawableStart="@drawable/ic_schedule"
style="@style/aerr_list_item" />
- <TextView
+ <Button
android:id="@+id/aerr_report"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/aerr_report"
+ android:drawableStart="@drawable/ic_feedback"
style="@style/aerr_list_item" />
</LinearLayout>
diff --git a/core/res/res/layout/app_error_dialog.xml b/core/res/res/layout/app_error_dialog.xml
index 46a2b2a..824f97f 100644
--- a/core/res/res/layout/app_error_dialog.xml
+++ b/core/res/res/layout/app_error_dialog.xml
@@ -21,9 +21,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
- android:paddingTop="@dimen/dialog_list_padding_vertical_material"
- android:paddingBottom="@dimen/dialog_list_padding_vertical_material"
->
+ android:paddingTop="@dimen/aerr_padding_list_top"
+ android:paddingBottom="@dimen/dialog_list_padding_vertical_material">
<Button
@@ -31,6 +30,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/aerr_restart"
+ android:drawableStart="@drawable/ic_refresh"
style="@style/aerr_list_item"
/>
@@ -39,6 +39,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/aerr_reset"
+ android:drawableStart="@drawable/ic_refresh"
style="@style/aerr_list_item"
/>
@@ -47,6 +48,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/aerr_report"
+ android:drawableStart="@drawable/ic_feedback"
style="@style/aerr_list_item"
/>
@@ -55,6 +57,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/aerr_close"
+ android:drawableStart="@drawable/ic_close"
style="@style/aerr_list_item"
/>
@@ -63,6 +66,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/aerr_mute"
+ android:drawableStart="@drawable/ic_close"
style="@style/aerr_list_item"
/>
diff --git a/core/res/res/layout/resolve_grid_item.xml b/core/res/res/layout/resolve_grid_item.xml
index 0a7ac77..305c8b0 100644
--- a/core/res/res/layout/resolve_grid_item.xml
+++ b/core/res/res/layout/resolve_grid_item.xml
@@ -25,6 +25,7 @@
android:gravity="center"
android:paddingTop="8dp"
android:paddingBottom="8dp"
+ android:focusable="true"
android:background="?attr/selectableItemBackgroundBorderless">
<FrameLayout android:layout_width="wrap_content"
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index 7c6f338..8e86f78 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -449,5 +449,7 @@
<item type="dimen" format="integer" name="time_picker_column_start_material">0</item>
<item type="dimen" format="integer" name="time_picker_column_end_material">1</item>
+ <item type="dimen" name="aerr_padding_list_top">15dp</item>
+
<item type="fraction" name="docked_stack_divider_fixed_ratio">34.15%</item>
</resources>
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index f0960c7..86b9f1d 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -1403,8 +1403,12 @@
<item name="textAppearance">?attr/textAppearanceListItemSmall</item>
<item name="textColor">?attr/textColorAlertDialogListItem</item>
<item name="gravity">center_vertical</item>
- <item name="paddingStart">?attr/listPreferredItemPaddingStart</item>
- <item name="paddingEnd">?attr/listPreferredItemPaddingEnd</item>
+ <item name="paddingStart">?attr/dialogPreferredPadding</item>
+ <item name="paddingEnd">?attr/dialogPreferredPadding</item>
+ <item name="background">?attr/selectableItemBackground</item>
+ <item name="drawablePadding">32dp</item>
+ <item name="drawableTint">@color/accent_material_light</item>
+ <item name="drawableTintMode">src_atop</item>
</style>
<!-- Wifi dialog styles -->
diff --git a/core/tests/coretests/src/android/print/BasePrintTest.java b/core/tests/coretests/src/android/print/BasePrintTest.java
index 19ce44a..3feb0e9 100644
--- a/core/tests/coretests/src/android/print/BasePrintTest.java
+++ b/core/tests/coretests/src/android/print/BasePrintTest.java
@@ -141,7 +141,7 @@
// Set to US locale.
Resources resources = getInstrumentation().getTargetContext().getResources();
Configuration oldConfiguration = resources.getConfiguration();
- if (!oldConfiguration.getLocales().getPrimary().equals(Locale.US)) {
+ if (!oldConfiguration.getLocales().get(0).equals(Locale.US)) {
mOldLocale = oldConfiguration.getLocales();
DisplayMetrics displayMetrics = resources.getDisplayMetrics();
Configuration newConfiguration = new Configuration(oldConfiguration);
diff --git a/data/fonts/Android.mk b/data/fonts/Android.mk
index d2bd106..de741b3 100644
--- a/data/fonts/Android.mk
+++ b/data/fonts/Android.mk
@@ -89,10 +89,7 @@
endef
font_src_files := \
- Clockopia.ttf \
- AndroidClock.ttf \
- AndroidClock_Highlight.ttf \
- AndroidClock_Solid.ttf
+ AndroidClock.ttf
$(foreach f, $(font_src_files), $(call build-one-font-module, $(f)))
diff --git a/data/fonts/AndroidClock_Highlight.ttf b/data/fonts/AndroidClock_Highlight.ttf
deleted file mode 100644
index 923bb30..0000000
--- a/data/fonts/AndroidClock_Highlight.ttf
+++ /dev/null
Binary files differ
diff --git a/data/fonts/AndroidClock_Solid.ttf b/data/fonts/AndroidClock_Solid.ttf
deleted file mode 100644
index 923bb30..0000000
--- a/data/fonts/AndroidClock_Solid.ttf
+++ /dev/null
Binary files differ
diff --git a/data/fonts/Clockopia.ttf b/data/fonts/Clockopia.ttf
deleted file mode 100644
index 3f7b6aaa..0000000
--- a/data/fonts/Clockopia.ttf
+++ /dev/null
Binary files differ
diff --git a/data/fonts/MTLc3m.ttf b/data/fonts/MTLc3m.ttf
deleted file mode 100644
index e9018f6..0000000
--- a/data/fonts/MTLc3m.ttf
+++ /dev/null
Binary files differ
diff --git a/data/fonts/MTLmr3m.ttf b/data/fonts/MTLmr3m.ttf
deleted file mode 100644
index 14f27d4..0000000
--- a/data/fonts/MTLmr3m.ttf
+++ /dev/null
Binary files differ
diff --git a/data/fonts/fonts.mk b/data/fonts/fonts.mk
index 597a122..acd785e 100644
--- a/data/fonts/fonts.mk
+++ b/data/fonts/fonts.mk
@@ -20,7 +20,4 @@
PRODUCT_PACKAGES := \
DroidSansFallback.ttf \
DroidSansMono.ttf \
- Clockopia.ttf \
AndroidClock.ttf \
- AndroidClock_Highlight.ttf \
- AndroidClock_Solid.ttf \
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index dfb8bb8..534121a 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -459,7 +459,7 @@
// setHinting(DisplayMetrics.DENSITY_DEVICE >= DisplayMetrics.DENSITY_TV
// ? HINTING_OFF : HINTING_ON);
mCompatScaling = mInvCompatScaling = 1;
- setTextLocales(LocaleList.getDefault());
+ setTextLocales(LocaleList.getAdjustedDefault());
}
/**
@@ -500,7 +500,7 @@
mInvCompatScaling = 1;
mBidiFlags = BIDI_DEFAULT_LTR;
- setTextLocales(LocaleList.getDefault());
+ setTextLocales(LocaleList.getAdjustedDefault());
setElegantTextHeight(false);
mFontFeatureSettings = null;
}
@@ -1292,7 +1292,7 @@
*/
@NonNull
public Locale getTextLocale() {
- return mLocales.getPrimary();
+ return mLocales.get(0);
}
/**
@@ -1317,7 +1317,7 @@
if (locale == null) {
throw new IllegalArgumentException("locale cannot be null");
}
- if (mLocales != null && mLocales.size() == 1 && locale.equals(mLocales.getPrimary())) {
+ if (mLocales != null && mLocales.size() == 1 && locale.equals(mLocales.get(0))) {
return;
}
mLocales = new LocaleList(locale);
@@ -1340,8 +1340,8 @@
* each language.
*
* By default, the text locale list is initialized to a one-member list just containing the
- * system locale (as returned by {@link LocaleList#getDefault()}). This assumes that the text to
- * be rendered will most likely be in the user's preferred language.
+ * system locales. This assumes that the text to be rendered will most likely be in the user's
+ * preferred language.
*
* If the actual language or languages of the text is/are known, then they can be provided to
* the text renderer using this method. The text renderer may attempt to guess the
diff --git a/graphics/java/android/graphics/Rect.java b/graphics/java/android/graphics/Rect.java
index 40dbe27..0cde0b9 100644
--- a/graphics/java/android/graphics/Rect.java
+++ b/graphics/java/android/graphics/Rect.java
@@ -335,6 +335,21 @@
}
/**
+ * Insets the rectangle on all sides specified by the insets.
+ * @hide
+ * @param left The amount to add from the rectangle's left
+ * @param top The amount to add from the rectangle's top
+ * @param right The amount to subtract from the rectangle's right
+ * @param bottom The amount to subtract from the rectangle's bottom
+ */
+ public void inset(int left, int top, int right, int bottom) {
+ this.left += left;
+ this.top += top;
+ this.right -= right;
+ this.bottom -= bottom;
+ }
+
+ /**
* Returns true if (x,y) is inside the rectangle. The left and top are
* considered to be inside, while the right and bottom are not. This means
* that for a x,y to be contained: left <= x < right and top <= y < bottom.
diff --git a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
index 21ed7dd..c48c371 100644
--- a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
+++ b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
@@ -19,10 +19,6 @@
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.Animator.AnimatorListener;
-import android.animation.PropertyValuesHolder;
-import android.animation.TimeInterpolator;
-import android.animation.ValueAnimator;
-import android.animation.ObjectAnimator;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.res.ColorStateList;
@@ -38,23 +34,14 @@
import android.util.ArrayMap;
import android.util.AttributeSet;
import android.util.Log;
-import android.util.LongArray;
-import android.util.PathParser;
-import android.util.TimeUtils;
-import android.view.Choreographer;
-import android.view.DisplayListCanvas;
-import android.view.RenderNode;
-import android.view.RenderNodeAnimatorSetHelper;
import android.view.View;
import com.android.internal.R;
-import com.android.internal.util.VirtualRefBasePtr;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
-import java.lang.ref.WeakReference;
import java.util.ArrayList;
/**
@@ -151,7 +138,7 @@
private static final boolean DBG_ANIMATION_VECTOR_DRAWABLE = false;
/** Local, mutable animator set. */
- private final VectorDrawableAnimator mAnimatorSet = new VectorDrawableAnimator();
+ private final AnimatorSet mAnimatorSet = new AnimatorSet();
/**
* The resources against which this drawable was created. Used to attempt
@@ -213,9 +200,6 @@
@Override
public void draw(Canvas canvas) {
- if (canvas.isHardwareAccelerated()) {
- mAnimatorSet.recordLastSeenTarget((DisplayListCanvas) canvas);
- }
mAnimatedVectorState.mVectorDrawable.draw(canvas);
if (isStarted()) {
invalidateSelf();
@@ -598,8 +582,9 @@
* Resets the AnimatedVectorDrawable to the start state as specified in the animators.
*/
public void reset() {
- mAnimatorSet.reset();
- invalidateSelf();
+ // TODO: Use reverse or seek to implement reset, when AnimatorSet supports them.
+ start();
+ mAnimatorSet.cancel();
}
@Override
@@ -618,12 +603,8 @@
@NonNull
private void ensureAnimatorSet() {
if (!mHasAnimatorSet) {
- // TODO: Skip the AnimatorSet creation and init the VectorDrawableAnimator directly
- // with a list of LocalAnimators.
- AnimatorSet set = new AnimatorSet();
- mAnimatedVectorState.prepareLocalAnimators(set, mRes);
+ mAnimatedVectorState.prepareLocalAnimators(mAnimatorSet, mRes);
mHasAnimatorSet = true;
- mAnimatorSet.initWithAnimatorSet(set);
mRes = null;
}
}
@@ -713,13 +694,13 @@
}
};
}
- mAnimatorSet.setListener(mAnimatorListener);
+ mAnimatorSet.addListener(mAnimatorListener);
}
// A helper function to clean up the animator listener in the mAnimatorSet.
private void removeAnimatorSetListener() {
if (mAnimatorListener != null) {
- mAnimatorSet.removeListener();
+ mAnimatorSet.removeListener(mAnimatorListener);
mAnimatorListener = null;
}
}
@@ -748,407 +729,4 @@
mAnimationCallbacks.clear();
}
-
- /**
- * @hide
- */
- public static class VectorDrawableAnimator {
- private AnimatorListener mListener = null;
- private final LongArray mStartDelays = new LongArray();
- private PropertyValuesHolder.PropertyValues mTmpValues =
- new PropertyValuesHolder.PropertyValues();
- private long mSetPtr = 0;
- private boolean mContainsSequentialAnimators = false;
- private boolean mStarted = false;
- private boolean mInitialized = false;
- private boolean mAnimationPending = false;
- private boolean mIsReversible = false;
- // TODO: Consider using NativeAllocationRegistery to track native allocation
- private final VirtualRefBasePtr mSetRefBasePtr;
- private WeakReference<RenderNode> mTarget = null;
- private WeakReference<RenderNode> mLastSeenTarget = null;
-
-
- VectorDrawableAnimator() {
- mSetPtr = nCreateAnimatorSet();
- // Increment ref count on native AnimatorSet, so it doesn't get released before Java
- // side is done using it.
- mSetRefBasePtr = new VirtualRefBasePtr(mSetPtr);
- }
-
- private void initWithAnimatorSet(AnimatorSet set) {
- if (mInitialized) {
- // Already initialized
- throw new UnsupportedOperationException("VectorDrawableAnimator cannot be " +
- "re-initialized");
- }
- parseAnimatorSet(set, 0);
- mInitialized = true;
-
- // Check reversible.
- if (mContainsSequentialAnimators) {
- mIsReversible = false;
- } else {
- // Check if there's any start delay set on child
- for (int i = 0; i < mStartDelays.size(); i++) {
- if (mStartDelays.get(i) > 0) {
- mIsReversible = false;
- return;
- }
- }
- }
- mIsReversible = true;
- }
-
- private void parseAnimatorSet(AnimatorSet set, long startTime) {
- ArrayList<Animator> animators = set.getChildAnimations();
-
- boolean playTogether = set.shouldPlayTogether();
- // Convert AnimatorSet to VectorDrawableAnimator
- for (int i = 0; i < animators.size(); i++) {
- Animator animator = animators.get(i);
- // Here we only support ObjectAnimator
- if (animator instanceof AnimatorSet) {
- parseAnimatorSet((AnimatorSet) animator, startTime);
- } else if (animator instanceof ObjectAnimator) {
- createRTAnimator((ObjectAnimator) animator, startTime);
- } // ignore ValueAnimators and others because they don't directly modify VD
- // therefore will be useless to AVD.
-
- if (!playTogether) {
- // Assume not play together means play sequentially
- startTime += animator.getTotalDuration();
- mContainsSequentialAnimators = true;
- }
- }
- }
-
- // TODO: This method reads animation data from already parsed Animators. We need to move
- // this step further up the chain in the parser to avoid the detour.
- private void createRTAnimator(ObjectAnimator animator, long startTime) {
- PropertyValuesHolder[] values = animator.getValues();
- Object target = animator.getTarget();
- if (target instanceof VectorDrawable.VGroup) {
- createRTAnimatorForGroup(values, animator, (VectorDrawable.VGroup) target,
- startTime);
- } else if (target instanceof VectorDrawable.VPath) {
- for (int i = 0; i < values.length; i++) {
- values[i].getPropertyValues(mTmpValues);
- if (mTmpValues.endValue instanceof PathParser.PathData &&
- mTmpValues.propertyName.equals("pathData")) {
- createRTAnimatorForPath(animator, (VectorDrawable.VPath) target,
- startTime);
- } else if (target instanceof VectorDrawable.VFullPath) {
- createRTAnimatorForFullPath(animator, (VectorDrawable.VFullPath) target,
- startTime);
- } else {
- throw new IllegalArgumentException("ClipPath only supports PathData " +
- "property");
- }
-
- }
- } else if (target instanceof VectorDrawable.VectorDrawableState) {
- createRTAnimatorForRootGroup(values, animator,
- (VectorDrawable.VectorDrawableState) target, startTime);
- } else {
- // Should never get here
- throw new UnsupportedOperationException("Target should be group, path or vector. " +
- target == null ? "Null target" : target.getClass() + " is not supported");
- }
- }
-
- private void createRTAnimatorForGroup(PropertyValuesHolder[] values,
- ObjectAnimator animator, VectorDrawable.VGroup target,
- long startTime) {
-
- long nativePtr = target.getNativePtr();
- int propertyId;
- for (int i = 0; i < values.length; i++) {
- // TODO: We need to support the rare case in AVD where no start value is provided
- values[i].getPropertyValues(mTmpValues);
- propertyId = VectorDrawable.VGroup.getPropertyIndex(mTmpValues.propertyName);
- if (mTmpValues.type != Float.class && mTmpValues.type != float.class) {
- if (DBG_ANIMATION_VECTOR_DRAWABLE) {
- Log.e(LOGTAG, "Unsupported type: " +
- mTmpValues.type + ". Only float value is supported for Groups.");
- }
- continue;
- }
- if (propertyId < 0) {
- if (DBG_ANIMATION_VECTOR_DRAWABLE) {
- Log.e(LOGTAG, "Unsupported property: " +
- mTmpValues.propertyName + " for Vector Drawable Group");
- }
- continue;
- }
- long propertyPtr = nCreateGroupPropertyHolder(nativePtr, propertyId,
- (Float) mTmpValues.startValue, (Float) mTmpValues.endValue);
- if (mTmpValues.dataSource != null) {
- float[] dataPoints = createDataPoints(mTmpValues.dataSource, animator
- .getDuration());
- nSetPropertyHolderData(propertyPtr, dataPoints, dataPoints.length);
- }
- createNativeChildAnimator(propertyPtr, startTime, animator);
- }
- }
- private void createRTAnimatorForPath( ObjectAnimator animator, VectorDrawable.VPath target,
- long startTime) {
-
- long nativePtr = target.getNativePtr();
- long startPathDataPtr = ((PathParser.PathData) mTmpValues.startValue)
- .getNativePtr();
- long endPathDataPtr = ((PathParser.PathData) mTmpValues.endValue)
- .getNativePtr();
- long propertyPtr = nCreatePathDataPropertyHolder(nativePtr, startPathDataPtr,
- endPathDataPtr);
- createNativeChildAnimator(propertyPtr, startTime, animator);
- }
-
- private void createRTAnimatorForFullPath(ObjectAnimator animator,
- VectorDrawable.VFullPath target, long startTime) {
-
- int propertyId = target.getPropertyIndex(mTmpValues.propertyName);
- long propertyPtr;
- long nativePtr = target.getNativePtr();
- if (mTmpValues.type == Float.class || mTmpValues.type == float.class) {
- if (propertyId < 0) {
- throw new IllegalArgumentException("Property: " + mTmpValues
- .propertyName + " is not supported for FullPath");
- }
- propertyPtr = nCreatePathPropertyHolder(nativePtr, propertyId,
- (Float) mTmpValues.startValue, (Float) mTmpValues.endValue);
-
- } else if (mTmpValues.type == Integer.class || mTmpValues.type == int.class) {
- propertyPtr = nCreatePathColorPropertyHolder(nativePtr, propertyId,
- (Integer) mTmpValues.startValue, (Integer) mTmpValues.endValue);
- } else {
- throw new UnsupportedOperationException("Unsupported type: " +
- mTmpValues.type + ". Only float, int or PathData value is " +
- "supported for Paths.");
- }
- if (mTmpValues.dataSource != null) {
- float[] dataPoints = createDataPoints(mTmpValues.dataSource, animator
- .getDuration());
- nSetPropertyHolderData(propertyPtr, dataPoints, dataPoints.length);
- }
- createNativeChildAnimator(propertyPtr, startTime, animator);
- }
-
- private void createRTAnimatorForRootGroup(PropertyValuesHolder[] values,
- ObjectAnimator animator, VectorDrawable.VectorDrawableState target,
- long startTime) {
- long nativePtr = target.getNativeRenderer();
- if (!animator.getPropertyName().equals("alpha")) {
- throw new UnsupportedOperationException("Only alpha is supported for root " +
- "group");
- }
- Float startValue = null;
- Float endValue = null;
- for (int i = 0; i < values.length; i++) {
- values[i].getPropertyValues(mTmpValues);
- if (mTmpValues.propertyName.equals("alpha")) {
- startValue = (Float) mTmpValues.startValue;
- endValue = (Float) mTmpValues.endValue;
- break;
- }
- }
- if (startValue == null && endValue == null) {
- throw new UnsupportedOperationException("No alpha values are specified");
- }
- long propertyPtr = nCreateRootAlphaPropertyHolder(nativePtr, startValue, endValue);
- createNativeChildAnimator(propertyPtr, startTime, animator);
- }
-
- // These are the data points that define the value of the animating properties.
- // e.g. translateX and translateY can animate along a Path, at any fraction in [0, 1]
- // a point on the path corresponds to the values of translateX and translateY.
- // TODO: (Optimization) We should pass the path down in native and chop it into segments
- // in native.
- private static float[] createDataPoints(
- PropertyValuesHolder.PropertyValues.DataSource dataSource, long duration) {
- long frameIntervalNanos = Choreographer.getInstance().getFrameIntervalNanos();
- int animIntervalMs = (int) (frameIntervalNanos / TimeUtils.NANOS_PER_MS);
- int numAnimFrames = (int) Math.ceil(((double) duration) / animIntervalMs);
- float values[] = new float[numAnimFrames];
- float lastFrame = numAnimFrames - 1;
- for (int i = 0; i < numAnimFrames; i++) {
- float fraction = i / lastFrame;
- values[i] = (Float) dataSource.getValueAtFraction(fraction);
- }
- return values;
- }
-
- private void createNativeChildAnimator(long propertyPtr, long extraDelay,
- ObjectAnimator animator) {
- long duration = animator.getDuration();
- int repeatCount = animator.getRepeatCount();
- long startDelay = extraDelay + animator.getStartDelay();
- TimeInterpolator interpolator = animator.getInterpolator();
- long nativeInterpolator =
- RenderNodeAnimatorSetHelper.createNativeInterpolator(interpolator, duration);
-
- startDelay *= ValueAnimator.getDurationScale();
- duration *= ValueAnimator.getDurationScale();
-
- mStartDelays.add(startDelay);
- nAddAnimator(mSetPtr, propertyPtr, nativeInterpolator, startDelay, duration,
- repeatCount);
- }
-
- /**
- * Holds a weak reference to the target that was last seen (through the DisplayListCanvas
- * in the last draw call), so that when animator set needs to start, we can add the animator
- * to the last seen RenderNode target and start right away.
- */
- protected void recordLastSeenTarget(DisplayListCanvas canvas) {
- if (mAnimationPending) {
- mLastSeenTarget = new WeakReference<RenderNode>(
- RenderNodeAnimatorSetHelper.getTarget(canvas));
- if (DBG_ANIMATION_VECTOR_DRAWABLE) {
- Log.d(LOGTAG, "Target is set in the next frame");
- }
- mAnimationPending = false;
- start();
- } else {
- mLastSeenTarget = new WeakReference<RenderNode>(
- RenderNodeAnimatorSetHelper.getTarget(canvas));
- }
-
- }
-
- private boolean setTarget(RenderNode node) {
- if (mTarget != null && mTarget.get() != null) {
- // TODO: Maybe we want to support target change.
- throw new IllegalStateException("Target already set!");
- }
-
- node.addAnimator(this);
- mTarget = new WeakReference<RenderNode>(node);
- return true;
- }
-
- private boolean useLastSeenTarget() {
- if (mLastSeenTarget != null && mLastSeenTarget.get() != null) {
- setTarget(mLastSeenTarget.get());
- return true;
- }
- return false;
- }
-
- public void start() {
- if (!mInitialized) {
- return;
- }
-
- if (mStarted) {
- return;
- }
-
- if (!useLastSeenTarget()) {
- mAnimationPending = true;
- return;
- }
-
- if (DBG_ANIMATION_VECTOR_DRAWABLE) {
- Log.d(LOGTAG, "Target is set. Starting VDAnimatorSet from java");
- }
-
- nStart(mSetPtr, this);
- if (mListener != null) {
- mListener.onAnimationStart(null);
- }
- mStarted = true;
- }
-
- public void end() {
- if (mInitialized && mStarted) {
- nEnd(mSetPtr);
- onAnimationEnd();
- }
- }
-
- void reset() {
- if (!mInitialized) {
- return;
- }
- // TODO: Need to implement reset.
- Log.w(LOGTAG, "Reset is yet to be implemented");
- nReset(mSetPtr);
- }
-
- // Current (imperfect) Java AnimatorSet cannot be reversed when the set contains sequential
- // animators or when the animator set has a start delay
- void reverse() {
- if (!mIsReversible) {
- return;
- }
- // TODO: Need to support reverse (non-public API)
- Log.w(LOGTAG, "Reverse is yet to be implemented");
- nReverse(mSetPtr, this);
- }
-
- public long getAnimatorNativePtr() {
- return mSetPtr;
- }
-
- boolean canReverse() {
- return mIsReversible;
- }
-
- boolean isStarted() {
- return mStarted;
- }
-
- boolean isRunning() {
- if (!mInitialized) {
- return false;
- }
- return mStarted;
- }
-
- void setListener(AnimatorListener listener) {
- mListener = listener;
- }
-
- void removeListener() {
- mListener = null;
- }
-
- private void onAnimationEnd() {
- mStarted = false;
- if (mListener != null) {
- mListener.onAnimationEnd(null);
- }
- mTarget = null;
- }
-
- // onFinished: should be called from native
- private static void callOnFinished(VectorDrawableAnimator set) {
- if (DBG_ANIMATION_VECTOR_DRAWABLE) {
- Log.d(LOGTAG, "on finished called from native");
- }
- set.onAnimationEnd();
- }
- }
-
- private static native long nCreateAnimatorSet();
- private static native void nAddAnimator(long setPtr, long propertyValuesHolder,
- long nativeInterpolator, long startDelay, long duration, int repeatCount);
-
- private static native long nCreateGroupPropertyHolder(long nativePtr, int propertyId,
- float startValue, float endValue);
-
- private static native long nCreatePathDataPropertyHolder(long nativePtr, long startValuePtr,
- long endValuePtr);
- private static native long nCreatePathColorPropertyHolder(long nativePtr, int propertyId,
- int startValue, int endValue);
- private static native long nCreatePathPropertyHolder(long nativePtr, int propertyId,
- float startValue, float endValue);
- private static native long nCreateRootAlphaPropertyHolder(long nativePtr, float startValue,
- float endValue);
- private static native void nSetPropertyHolderData(long nativePtr, float[] data, int length);
- private static native void nStart(long animatorSetPtr, VectorDrawableAnimator set);
- private static native void nReverse(long animatorSetPtr, VectorDrawableAnimator set);
- private static native void nEnd(long animatorSetPtr);
- private static native void nReset(long animatorSetPtr);
}
diff --git a/graphics/java/android/graphics/drawable/VectorDrawable.java b/graphics/java/android/graphics/drawable/VectorDrawable.java
index f4bbc8c..1fc1b83 100644
--- a/graphics/java/android/graphics/drawable/VectorDrawable.java
+++ b/graphics/java/android/graphics/drawable/VectorDrawable.java
@@ -39,7 +39,6 @@
import android.util.Xml;
import com.android.internal.R;
-import com.android.internal.util.VirtualRefBasePtr;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -48,7 +47,6 @@
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Stack;
/**
@@ -524,13 +522,13 @@
public void inflate(@NonNull Resources r, @NonNull XmlPullParser parser,
@NonNull AttributeSet attrs, @Nullable Theme theme)
throws XmlPullParserException, IOException {
- if (mVectorState.mRootGroup != null || mVectorState.mNativeRendererRefBase != null) {
+ if (mVectorState.mRootGroup != null || mVectorState.mNativeRendererPtr != 0) {
// This VD has been used to display other VD resource content, clean up.
mVectorState.mRootGroup = new VGroup();
- if (mVectorState.mNativeRendererRefBase != null) {
- mVectorState.mNativeRendererRefBase.release();
+ if (mVectorState.mNativeRendererPtr != 0) {
+ nDestroyRenderer(mVectorState.mNativeRendererPtr);
}
- mVectorState.createNativeRenderer(mVectorState.mRootGroup.mNativePtr);
+ mVectorState.mNativeRendererPtr = nCreateRenderer(mVectorState.mRootGroup.mNativePtr);
}
final VectorDrawableState state = mVectorState;
state.setDensity(Drawable.resolveDensity(r, 0));
@@ -709,7 +707,7 @@
return mVectorState.mAutoMirrored;
}
- static class VectorDrawableState extends ConstantState {
+ private static class VectorDrawableState extends ConstantState {
// Variables below need to be copied (deep copy if applicable) for mutation.
int[] mThemeAttrs;
int mChangingConfigurations;
@@ -724,7 +722,7 @@
Insets mOpticalInsets = Insets.NONE;
String mRootName = null;
VGroup mRootGroup;
- VirtualRefBasePtr mNativeRendererRefBase = null;
+ long mNativeRendererPtr;
int mDensity = DisplayMetrics.DENSITY_DEFAULT;
final ArrayMap<String, Object> mVGTargetsMap = new ArrayMap<>();
@@ -745,7 +743,7 @@
mTintMode = copy.mTintMode;
mAutoMirrored = copy.mAutoMirrored;
mRootGroup = new VGroup(copy.mRootGroup, mVGTargetsMap);
- createNativeRenderer(mRootGroup.mNativePtr);
+ mNativeRendererPtr = nCreateRenderer(mRootGroup.mNativePtr);
mBaseWidth = copy.mBaseWidth;
mBaseHeight = copy.mBaseHeight;
@@ -760,15 +758,18 @@
}
}
- private void createNativeRenderer(long rootGroupPtr) {
- mNativeRendererRefBase = new VirtualRefBasePtr(nCreateRenderer(rootGroupPtr));
+ @Override
+ public void finalize() throws Throwable {
+ if (mNativeRendererPtr != 0) {
+ nDestroyRenderer(mNativeRendererPtr);
+ mNativeRendererPtr = 0;
+ }
+ super.finalize();
}
+
long getNativeRenderer() {
- if (mNativeRendererRefBase == null) {
- return 0;
- }
- return mNativeRendererRefBase.get();
+ return mNativeRendererPtr;
}
public boolean canReuseCache() {
@@ -807,7 +808,7 @@
public VectorDrawableState() {
mRootGroup = new VGroup();
- createNativeRenderer(mRootGroup.mNativePtr);
+ mNativeRendererPtr = nCreateRenderer(mRootGroup.mNativePtr);
}
@Override
@@ -871,16 +872,16 @@
* has changed.
*/
public boolean setAlpha(float alpha) {
- return nSetRootAlpha(mNativeRendererRefBase.get(), alpha);
+ return nSetRootAlpha(mNativeRendererPtr, alpha);
}
@SuppressWarnings("unused")
public float getAlpha() {
- return nGetRootAlpha(mNativeRendererRefBase.get());
+ return nGetRootAlpha(mNativeRendererPtr);
}
}
- static class VGroup implements VObject {
+ private static class VGroup implements VObject {
private static final int ROTATE_INDEX = 0;
private static final int PIVOT_X_INDEX = 1;
private static final int PIVOT_Y_INDEX = 2;
@@ -890,28 +891,6 @@
private static final int TRANSLATE_Y_INDEX = 6;
private static final int TRANSFORM_PROPERTY_COUNT = 7;
- private static final HashMap<String, Integer> sPropertyMap =
- new HashMap<String, Integer>() {
- {
- put("translateX", TRANSLATE_X_INDEX);
- put("translateY", TRANSLATE_Y_INDEX);
- put("scaleX", SCALE_X_INDEX);
- put("scaleY", SCALE_Y_INDEX);
- put("pivotX", PIVOT_X_INDEX);
- put("pivotY", PIVOT_Y_INDEX);
- put("rotation", ROTATE_INDEX);
- }
- };
-
- static int getPropertyIndex(String propertyName) {
- if (sPropertyMap.containsKey(propertyName)) {
- return sPropertyMap.get(propertyName);
- } else {
- // property not found
- return -1;
- }
- }
-
// Temp array to store transform values obtained from native.
private float[] mTransform;
/////////////////////////////////////////////////////
@@ -1170,7 +1149,7 @@
/**
* Common Path information for clip path and normal path.
*/
- static abstract class VPath implements VObject {
+ private static abstract class VPath implements VObject {
protected PathParser.PathData mPathData = null;
String mPathName;
@@ -1281,7 +1260,7 @@
/**
* Normal path, which contains all the fill / paint information.
*/
- static class VFullPath extends VPath {
+ private static class VFullPath extends VPath {
private static final int STROKE_WIDTH_INDEX = 0;
private static final int STROKE_COLOR_INDEX = 1;
private static final int STROKE_ALPHA_INDEX = 2;
@@ -1295,20 +1274,6 @@
private static final int STROKE_MITER_LIMIT_INDEX = 10;
private static final int TOTAL_PROPERTY_COUNT = 11;
- private final static HashMap<String, Integer> sPropertyMap
- = new HashMap<String, Integer> () {
- {
- put("strokeWidth", STROKE_WIDTH_INDEX);
- put("strokeColor", STROKE_COLOR_INDEX);
- put("strokeAlpha", STROKE_ALPHA_INDEX);
- put("fillColor", FILL_COLOR_INDEX);
- put("fillAlpha", FILL_ALPHA_INDEX);
- put("trimPathStart", TRIM_PATH_START_INDEX);
- put("trimPathEnd", TRIM_PATH_END_INDEX);
- put("trimPathOffset", TRIM_PATH_OFFSET_INDEX);
- }
- };
-
// Temp array to store property data obtained from native getter.
private byte[] mPropertyData;
/////////////////////////////////////////////////////
@@ -1332,14 +1297,6 @@
mFillColors = copy.mFillColors;
}
- int getPropertyIndex(String propertyName) {
- if (!sPropertyMap.containsKey(propertyName)) {
- return -1;
- } else {
- return sPropertyMap.get(propertyName);
- }
- }
-
@Override
public boolean onStateChange(int[] stateSet) {
boolean changed = false;
@@ -1638,6 +1595,7 @@
}
private static native long nCreateRenderer(long rootGroupPtr);
+ private static native void nDestroyRenderer(long rendererPtr);
private static native void nSetRendererViewportSize(long rendererPtr, float viewportWidth,
float viewportHeight);
private static native boolean nSetRootAlpha(long rendererPtr, float alpha);
diff --git a/libs/hwui/Android.mk b/libs/hwui/Android.mk
index c232bd1..1fb9ac5 100644
--- a/libs/hwui/Android.mk
+++ b/libs/hwui/Android.mk
@@ -78,8 +78,6 @@
Program.cpp \
ProgramCache.cpp \
Properties.cpp \
- PropertyValuesHolder.cpp \
- PropertyValuesAnimatorSet.cpp \
RenderBufferCache.cpp \
RenderNode.cpp \
RenderProperties.cpp \
diff --git a/libs/hwui/Animator.cpp b/libs/hwui/Animator.cpp
index 7bd2b24..5ca2a2f 100644
--- a/libs/hwui/Animator.cpp
+++ b/libs/hwui/Animator.cpp
@@ -90,9 +90,6 @@
doSetStartValue(getValue(mTarget));
}
if (mStagingPlayState > mPlayState) {
- if (mStagingPlayState == PlayState::Restarted) {
- mStagingPlayState = PlayState::Running;
- }
mPlayState = mStagingPlayState;
// Oh boy, we're starting! Man the battle stations!
if (mPlayState == PlayState::Running) {
@@ -134,11 +131,6 @@
return true;
}
- // This should be set before setValue() so animators can query this time when setValue
- // is called.
- nsecs_t currentFrameTime = context.frameTimeMs();
- onPlayTimeChanged(currentFrameTime - mStartTime);
-
// If BaseRenderNodeAnimator is handling the delay (not typical), then
// because the staging properties reflect the final value, we always need
// to call setValue even if the animation isn't yet running or is still
@@ -149,9 +141,8 @@
}
float fraction = 1.0f;
-
if (mPlayState == PlayState::Running && mDuration > 0) {
- fraction = (float)(currentFrameTime - mStartTime) / mDuration;
+ fraction = (float)(context.frameTimeMs() - mStartTime) / mDuration;
}
if (fraction >= 1.0f) {
fraction = 1.0f;
diff --git a/libs/hwui/Animator.h b/libs/hwui/Animator.h
index 2c9c9c3..aea95bf 100644
--- a/libs/hwui/Animator.h
+++ b/libs/hwui/Animator.h
@@ -59,13 +59,7 @@
mMayRunAsync = mayRunAsync;
}
bool mayRunAsync() { return mMayRunAsync; }
- ANDROID_API void start() {
- if (mStagingPlayState == PlayState::NotStarted) {
- mStagingPlayState = PlayState::Running;
- } else {
- mStagingPlayState = PlayState::Restarted;
- }
- onStagingPlayStateChanged(); }
+ ANDROID_API void start() { mStagingPlayState = PlayState::Running; onStagingPlayStateChanged(); }
ANDROID_API void end() { mStagingPlayState = PlayState::Finished; onStagingPlayStateChanged(); }
void attach(RenderNode* target);
@@ -83,27 +77,10 @@
void forceEndNow(AnimationContext& context);
protected:
- // PlayState is used by mStagingPlayState and mPlayState to track the state initiated from UI
- // thread and Render Thread animation state, respectively.
- // From the UI thread, mStagingPlayState transition looks like
- // NotStarted -> Running -> Finished
- // ^ |
- // | |
- // Restarted <------
- // Note: For mStagingState, the Finished state (optional) is only set when the animation is
- // terminated by user.
- //
- // On Render Thread, mPlayState transition:
- // NotStart -> Running -> Finished
- // ^ |
- // | |
- // -------------
-
enum class PlayState {
NotStarted,
Running,
Finished,
- Restarted,
};
BaseRenderNodeAnimator(float finalValue);
@@ -116,7 +93,6 @@
void callOnFinishedListener(AnimationContext& context);
virtual void onStagingPlayStateChanged() {}
- virtual void onPlayTimeChanged(nsecs_t playTime) {}
RenderNode* mTarget;
diff --git a/libs/hwui/Canvas.h b/libs/hwui/Canvas.h
index 27facdf..dbd502d 100644
--- a/libs/hwui/Canvas.h
+++ b/libs/hwui/Canvas.h
@@ -52,13 +52,6 @@
} // namespace SaveFlags
-namespace uirenderer {
-namespace VectorDrawable {
-class Tree;
-};
-};
-typedef uirenderer::VectorDrawable::Tree VectorDrawableRoot;
-
class ANDROID_API Canvas {
public:
virtual ~Canvas() {};
@@ -224,11 +217,6 @@
*/
virtual bool drawTextAbsolutePos() const = 0;
- /**
- * Draws a VectorDrawable onto the canvas.
- */
- virtual void drawVectorDrawable(VectorDrawableRoot* tree);
-
protected:
void drawTextDecorations(float x, float y, float length, const SkPaint& paint);
};
diff --git a/libs/hwui/DamageAccumulator.h b/libs/hwui/DamageAccumulator.h
index e44fc20..250296e 100644
--- a/libs/hwui/DamageAccumulator.h
+++ b/libs/hwui/DamageAccumulator.h
@@ -57,7 +57,7 @@
// Returns the current dirty area, *NOT* transformed by pushed transforms
void peekAtDirty(SkRect* dest) const;
- void computeCurrentTransform(Matrix4* outMatrix) const;
+ ANDROID_API void computeCurrentTransform(Matrix4* outMatrix) const;
void finish(SkRect* totalDirty);
diff --git a/libs/hwui/DisplayListCanvas.cpp b/libs/hwui/DisplayListCanvas.cpp
index 3db14b5..7eaa785 100644
--- a/libs/hwui/DisplayListCanvas.cpp
+++ b/libs/hwui/DisplayListCanvas.cpp
@@ -16,12 +16,11 @@
#include "DisplayListCanvas.h"
+#include "ResourceCache.h"
#include "DeferredDisplayList.h"
#include "DeferredLayerUpdater.h"
#include "DisplayListOp.h"
-#include "ResourceCache.h"
#include "RenderNode.h"
-#include "VectorDrawable.h"
#include "utils/PaintUtils.h"
#include <SkCamera.h>
@@ -413,16 +412,6 @@
addDrawOp(new (alloc()) DrawPointsOp(points, count, refPaint(&paint)));
}
-void DisplayListCanvas::drawVectorDrawable(VectorDrawableRoot* tree) {
- mDisplayList->ref(tree);
- const SkBitmap& bitmap = tree->getBitmapUpdateIfDirty();
- SkPaint* paint = tree->getPaint();
- const SkRect bounds = tree->getBounds();
- addDrawOp(new (alloc()) DrawBitmapRectOp(refBitmap(bitmap),
- 0, 0, bitmap.width(), bitmap.height(),
- bounds.left(), bounds.top(), bounds.right(), bounds.bottom(), refPaint(paint)));
-}
-
void DisplayListCanvas::drawTextOnPath(const uint16_t* glyphs, int count,
const SkPath& path, float hOffset, float vOffset, const SkPaint& paint) {
if (!glyphs || count <= 0) return;
diff --git a/libs/hwui/DisplayListCanvas.h b/libs/hwui/DisplayListCanvas.h
index 06e72a0..ad93960 100644
--- a/libs/hwui/DisplayListCanvas.h
+++ b/libs/hwui/DisplayListCanvas.h
@@ -206,8 +206,6 @@
float dstLeft, float dstTop, float dstRight, float dstBottom,
const SkPaint* paint) override;
- virtual void drawVectorDrawable(VectorDrawableRoot* tree) override;
-
// Text
virtual void drawText(const uint16_t* glyphs, const float* positions, int count,
const SkPaint& paint, float x, float y, float boundsLeft, float boundsTop,
@@ -216,6 +214,7 @@
float hOffset, float vOffset, const SkPaint& paint) override;
virtual bool drawTextAbsolutePos() const override { return false; }
+
private:
CanvasState mState;
diff --git a/libs/hwui/FrameBuilder.cpp b/libs/hwui/FrameBuilder.cpp
index 185acce..c8910cb 100644
--- a/libs/hwui/FrameBuilder.cpp
+++ b/libs/hwui/FrameBuilder.cpp
@@ -19,7 +19,6 @@
#include "Canvas.h"
#include "LayerUpdateQueue.h"
#include "RenderNode.h"
-#include "VectorDrawable.h"
#include "renderstate/OffscreenBufferPool.h"
#include "utils/FatVector.h"
#include "utils/PaintUtils.h"
@@ -546,18 +545,6 @@
currentLayer().deferUnmergeableOp(mAllocator, bakedState, OpBatchType::Bitmap);
}
-void FrameBuilder::deferVectorDrawableOp(const VectorDrawableOp& op) {
- const SkBitmap& bitmap = op.vectorDrawable->getBitmapUpdateIfDirty();
- SkPaint* paint = op.vectorDrawable->getPaint();
- const BitmapRectOp* resolvedOp = new (mAllocator) BitmapRectOp(op.unmappedBounds,
- op.localMatrix,
- op.localClip,
- paint,
- &bitmap,
- Rect(bitmap.width(), bitmap.height()));
- deferBitmapRectOp(*resolvedOp);
-}
-
void FrameBuilder::deferCirclePropsOp(const CirclePropsOp& op) {
// allocate a temporary oval op (with mAllocator, so it persists until render), so the
// renderer doesn't have to handle the RoundRectPropsOp type, and so state baking is simple.
diff --git a/libs/hwui/PropertyValuesAnimatorSet.cpp b/libs/hwui/PropertyValuesAnimatorSet.cpp
deleted file mode 100644
index eca1afcc..0000000
--- a/libs/hwui/PropertyValuesAnimatorSet.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.
- */
-
-#include "PropertyValuesAnimatorSet.h"
-#include "RenderNode.h"
-
-namespace android {
-namespace uirenderer {
-
-void PropertyValuesAnimatorSet::addPropertyAnimator(PropertyValuesHolder* propertyValuesHolder,
- Interpolator* interpolator, nsecs_t startDelay,
- nsecs_t duration, int repeatCount) {
-
- PropertyAnimator* animator = new PropertyAnimator(propertyValuesHolder,
- interpolator, startDelay, duration, repeatCount);
- mAnimators.emplace_back(animator);
- setListener(new PropertyAnimatorSetListener(this));
-}
-
-PropertyValuesAnimatorSet::PropertyValuesAnimatorSet()
- : BaseRenderNodeAnimator(1.0f) {
- setStartValue(0);
- mLastFraction = 0.0f;
- setInterpolator(new LinearInterpolator());
-}
-
-void PropertyValuesAnimatorSet::onFinished(BaseRenderNodeAnimator* animator) {
- if (mOneShotListener.get()) {
- mOneShotListener->onAnimationFinished(animator);
- mOneShotListener = nullptr;
- }
-}
-
-float PropertyValuesAnimatorSet::getValue(RenderNode* target) const {
- return mLastFraction;
-}
-
-void PropertyValuesAnimatorSet::setValue(RenderNode* target, float value) {
- mLastFraction = value;
-}
-
-void PropertyValuesAnimatorSet::onPlayTimeChanged(nsecs_t playTime) {
- for (size_t i = 0; i < mAnimators.size(); i++) {
- mAnimators[i]->setCurrentPlayTime(playTime);
- }
-}
-
-void PropertyValuesAnimatorSet::reset() {
- // TODO: implement reset through adding a play state because we need to support reset() even
- // during an animation run.
-}
-
-void PropertyValuesAnimatorSet::start(AnimationListener* listener) {
- init();
- mOneShotListener = listener;
- BaseRenderNodeAnimator::start();
-}
-
-void PropertyValuesAnimatorSet::reverse(AnimationListener* listener) {
-// TODO: implement reverse
-}
-
-void PropertyValuesAnimatorSet::init() {
- if (mInitialized) {
- return;
- }
- nsecs_t maxDuration = 0;
- for (size_t i = 0; i < mAnimators.size(); i++) {
- if (maxDuration < mAnimators[i]->getTotalDuration()) {
- maxDuration = mAnimators[i]->getTotalDuration();
- }
- }
- mDuration = maxDuration;
- mInitialized = true;
-}
-
-uint32_t PropertyValuesAnimatorSet::dirtyMask() {
- return RenderNode::DISPLAY_LIST;
-}
-
-PropertyAnimator::PropertyAnimator(PropertyValuesHolder* holder, Interpolator* interpolator,
- nsecs_t startDelay, nsecs_t duration, int repeatCount)
- : mPropertyValuesHolder(holder), mInterpolator(interpolator), mStartDelay(startDelay),
- mDuration(duration) {
- if (repeatCount < 0) {
- mRepeatCount = UINT32_MAX;
- } else {
- mRepeatCount = repeatCount;
- }
- mTotalDuration = ((nsecs_t) mRepeatCount + 1) * mDuration + mStartDelay;
-}
-
-void PropertyAnimator::setCurrentPlayTime(nsecs_t playTime) {
- if (playTime >= mStartDelay && playTime < mTotalDuration) {
- nsecs_t currentIterationPlayTime = (playTime - mStartDelay) % mDuration;
- mLatestFraction = currentIterationPlayTime / (float) mDuration;
- } else if (mLatestFraction < 1.0f && playTime >= mTotalDuration) {
- mLatestFraction = 1.0f;
- } else {
- return;
- }
-
- setFraction(mLatestFraction);
-}
-
-void PropertyAnimator::setFraction(float fraction) {
- float interpolatedFraction = mInterpolator->interpolate(mLatestFraction);
- mPropertyValuesHolder->setFraction(interpolatedFraction);
-}
-
-void PropertyAnimatorSetListener::onAnimationFinished(BaseRenderNodeAnimator* animator) {
- mSet->onFinished(animator);
-}
-
-}
-}
diff --git a/libs/hwui/PropertyValuesAnimatorSet.h b/libs/hwui/PropertyValuesAnimatorSet.h
deleted file mode 100644
index 4c7ce52..0000000
--- a/libs/hwui/PropertyValuesAnimatorSet.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include "Animator.h"
-#include "PropertyValuesHolder.h"
-#include "Interpolator.h"
-
-namespace android {
-namespace uirenderer {
-
-class PropertyAnimator {
-public:
- PropertyAnimator(PropertyValuesHolder* holder, Interpolator* interpolator, nsecs_t startDelay,
- nsecs_t duration, int repeatCount);
- void setCurrentPlayTime(nsecs_t playTime);
- nsecs_t getTotalDuration() {
- return mTotalDuration;
- }
- void setFraction(float fraction);
-
-private:
- std::unique_ptr<PropertyValuesHolder> mPropertyValuesHolder;
- std::unique_ptr<Interpolator> mInterpolator;
- nsecs_t mStartDelay;
- nsecs_t mDuration;
- uint32_t mRepeatCount;
- nsecs_t mTotalDuration;
- float mLatestFraction = 0.0f;
-};
-
-class ANDROID_API PropertyValuesAnimatorSet : public BaseRenderNodeAnimator {
-public:
- friend class PropertyAnimatorSetListener;
- PropertyValuesAnimatorSet();
-
- void start(AnimationListener* listener);
- void reverse(AnimationListener* listener);
- void reset();
-
- void addPropertyAnimator(PropertyValuesHolder* propertyValuesHolder,
- Interpolator* interpolators, int64_t startDelays,
- nsecs_t durations, int repeatCount);
- virtual uint32_t dirtyMask();
-
-protected:
- virtual float getValue(RenderNode* target) const override;
- virtual void setValue(RenderNode* target, float value) override;
- virtual void onPlayTimeChanged(nsecs_t playTime) override;
-
-private:
- void init();
- void onFinished(BaseRenderNodeAnimator* animator);
- // Listener set from outside
- sp<AnimationListener> mOneShotListener;
- std::vector< std::unique_ptr<PropertyAnimator> > mAnimators;
- float mLastFraction = 0.0f;
- bool mInitialized = false;
-};
-
-class PropertyAnimatorSetListener : public AnimationListener {
-public:
- PropertyAnimatorSetListener(PropertyValuesAnimatorSet* set) : mSet(set) {}
- virtual void onAnimationFinished(BaseRenderNodeAnimator* animator) override;
-
-private:
- PropertyValuesAnimatorSet* mSet;
-};
-
-} // namespace uirenderer
-} // namespace android
diff --git a/libs/hwui/PropertyValuesHolder.cpp b/libs/hwui/PropertyValuesHolder.cpp
deleted file mode 100644
index 8f837f6..0000000
--- a/libs/hwui/PropertyValuesHolder.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.
- */
-
-#include "PropertyValuesHolder.h"
-
-#include "utils/VectorDrawableUtils.h"
-
-#include <utils/Log.h>
-
-namespace android {
-namespace uirenderer {
-
-using namespace VectorDrawable;
-
-float PropertyValuesHolder::getValueFromData(float fraction) {
- if (mDataSource.size() == 0) {
- LOG_ALWAYS_FATAL("No data source is defined");
- return 0;
- }
- if (fraction <= 0.0f) {
- return mDataSource.front();
- }
- if (fraction >= 1.0f) {
- return mDataSource.back();
- }
-
- fraction *= mDataSource.size() - 1;
- int lowIndex = floor(fraction);
- fraction -= lowIndex;
-
- float value = mDataSource[lowIndex] * (1.0f - fraction)
- + mDataSource[lowIndex + 1] * fraction;
- return value;
-}
-
-void GroupPropertyValuesHolder::setFraction(float fraction) {
- float animatedValue;
- if (mDataSource.size() > 0) {
- animatedValue = getValueFromData(fraction);
- } else {
- animatedValue = mStartValue * (1 - fraction) + mEndValue * fraction;
- }
- mGroup->setPropertyValue(mPropertyId, animatedValue);
-}
-
-inline U8CPU lerp(U8CPU fromValue, U8CPU toValue, float fraction) {
- return (U8CPU) (fromValue * (1 - fraction) + toValue * fraction);
-}
-
-// TODO: Add a test for this
-SkColor FullPathColorPropertyValuesHolder::interpolateColors(SkColor fromColor, SkColor toColor,
- float fraction) {
- U8CPU alpha = lerp(SkColorGetA(fromColor), SkColorGetA(toColor), fraction);
- U8CPU red = lerp(SkColorGetR(fromColor), SkColorGetR(toColor), fraction);
- U8CPU green = lerp(SkColorGetG(fromColor), SkColorGetG(toColor), fraction);
- U8CPU blue = lerp(SkColorGetB(fromColor), SkColorGetB(toColor), fraction);
- return SkColorSetARGB(alpha, red, green, blue);
-}
-
-void FullPathColorPropertyValuesHolder::setFraction(float fraction) {
- SkColor animatedValue = interpolateColors(mStartValue, mEndValue, fraction);
- mFullPath->setColorPropertyValue(mPropertyId, animatedValue);
-}
-
-void FullPathPropertyValuesHolder::setFraction(float fraction) {
- float animatedValue;
- if (mDataSource.size() > 0) {
- animatedValue = getValueFromData(fraction);
- } else {
- animatedValue = mStartValue * (1 - fraction) + mEndValue * fraction;
- }
- mFullPath->setPropertyValue(mPropertyId, animatedValue);
-}
-
-void PathDataPropertyValuesHolder::setFraction(float fraction) {
- VectorDrawableUtils::interpolatePaths(&mPathData, mStartValue, mEndValue, fraction);
- mPath->setPathData(mPathData);
-}
-
-void RootAlphaPropertyValuesHolder::setFraction(float fraction) {
- float animatedValue = mStartValue * (1 - fraction) + mEndValue * fraction;
- mTree->setRootAlpha(animatedValue);
-}
-
-} // namepace uirenderer
-} // namespace android
diff --git a/libs/hwui/PropertyValuesHolder.h b/libs/hwui/PropertyValuesHolder.h
deleted file mode 100644
index b905fae..0000000
--- a/libs/hwui/PropertyValuesHolder.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include "VectorDrawable.h"
-
-#include <SkColor.h>
-
-namespace android {
-namespace uirenderer {
-
-/**
- * PropertyValues holder contains data needed to change a property of a Vector Drawable object.
- * When a fraction in [0f, 1f] is provided, the holder will calculate an interpolated value based
- * on its start and end value, and set the new value on the VectorDrawble's corresponding property.
- */
-class ANDROID_API PropertyValuesHolder {
-public:
- virtual void setFraction(float fraction) = 0;
- void setPropertyDataSource(float* dataSource, int length) {
- mDataSource.insert(mDataSource.begin(), dataSource, dataSource + length);
- }
- float getValueFromData(float fraction);
- virtual ~PropertyValuesHolder() {}
-protected:
- std::vector<float> mDataSource;
-};
-
-class ANDROID_API GroupPropertyValuesHolder : public PropertyValuesHolder {
-public:
- GroupPropertyValuesHolder(VectorDrawable::Group* ptr, int propertyId, float startValue,
- float endValue)
- : mGroup(ptr)
- , mPropertyId(propertyId)
- , mStartValue(startValue)
- , mEndValue(endValue){
- }
- void setFraction(float fraction) override;
-private:
- VectorDrawable::Group* mGroup;
- int mPropertyId;
- float mStartValue;
- float mEndValue;
-};
-
-class ANDROID_API FullPathColorPropertyValuesHolder : public PropertyValuesHolder {
-public:
- FullPathColorPropertyValuesHolder(VectorDrawable::FullPath* ptr, int propertyId, int32_t startValue,
- int32_t endValue)
- : mFullPath(ptr)
- , mPropertyId(propertyId)
- , mStartValue(startValue)
- , mEndValue(endValue) {};
- void setFraction(float fraction) override;
- static SkColor interpolateColors(SkColor fromColor, SkColor toColor, float fraction);
-private:
- VectorDrawable::FullPath* mFullPath;
- int mPropertyId;
- int32_t mStartValue;
- int32_t mEndValue;
-};
-
-class ANDROID_API FullPathPropertyValuesHolder : public PropertyValuesHolder {
-public:
- FullPathPropertyValuesHolder(VectorDrawable::FullPath* ptr, int propertyId, float startValue,
- float endValue)
- : mFullPath(ptr)
- , mPropertyId(propertyId)
- , mStartValue(startValue)
- , mEndValue(endValue) {};
- void setFraction(float fraction) override;
-private:
- VectorDrawable::FullPath* mFullPath;
- int mPropertyId;
- float mStartValue;
- float mEndValue;
-};
-
-class ANDROID_API PathDataPropertyValuesHolder : public PropertyValuesHolder {
-public:
- PathDataPropertyValuesHolder(VectorDrawable::Path* ptr, PathData* startValue,
- PathData* endValue)
- : mPath(ptr)
- , mStartValue(*startValue)
- , mEndValue(*endValue) {};
- void setFraction(float fraction) override;
-private:
- VectorDrawable::Path* mPath;
- PathData mPathData;
- PathData mStartValue;
- PathData mEndValue;
-};
-
-class ANDROID_API RootAlphaPropertyValuesHolder : public PropertyValuesHolder {
-public:
- RootAlphaPropertyValuesHolder(VectorDrawable::Tree* tree, float startValue, float endValue)
- : mTree(tree)
- , mStartValue(startValue)
- , mEndValue(endValue) {}
- void setFraction(float fraction) override;
-private:
- VectorDrawable::Tree* mTree;
- float mStartValue;
- float mEndValue;
-};
-}
-}
diff --git a/libs/hwui/RecordedOp.h b/libs/hwui/RecordedOp.h
index bb26e2e..593d690 100644
--- a/libs/hwui/RecordedOp.h
+++ b/libs/hwui/RecordedOp.h
@@ -17,7 +17,6 @@
#ifndef ANDROID_HWUI_RECORDED_OP_H
#define ANDROID_HWUI_RECORDED_OP_H
-#include "RecordedOp.h"
#include "font/FontUtil.h"
#include "Matrix.h"
#include "Rect.h"
@@ -40,10 +39,6 @@
class RenderNode;
struct Vertex;
-namespace VectorDrawable {
-class Tree;
-}
-
/**
* Authoritative op list, used for generating the op ID enum, ID based LUTS, and
* the functions to which they dispatch. Parameter macros are executed for each op,
@@ -80,7 +75,6 @@
PRE_RENDER_OP_FN(EndLayerOp) \
PRE_RENDER_OP_FN(BeginUnclippedLayerOp) \
PRE_RENDER_OP_FN(EndUnclippedLayerOp) \
- PRE_RENDER_OP_FN(VectorDrawableOp) \
\
RENDER_ONLY_OP_FN(ShadowOp) \
RENDER_ONLY_OP_FN(LayerOp) \
@@ -331,13 +325,6 @@
const float* ry;
};
-struct VectorDrawableOp : RecordedOp {
- VectorDrawableOp(VectorDrawable::Tree* tree, BASE_PARAMS_PAINTLESS)
- : SUPER_PAINTLESS(VectorDrawableOp)
- , vectorDrawable(tree) {}
- VectorDrawable::Tree* vectorDrawable;
-};
-
/**
* Real-time, dynamic-lit shadow.
*
diff --git a/libs/hwui/RecordingCanvas.cpp b/libs/hwui/RecordingCanvas.cpp
index 16929b8..2387962 100644
--- a/libs/hwui/RecordingCanvas.cpp
+++ b/libs/hwui/RecordingCanvas.cpp
@@ -19,7 +19,6 @@
#include "DeferredLayerUpdater.h"
#include "RecordedOp.h"
#include "RenderNode.h"
-#include "VectorDrawable.h"
namespace android {
namespace uirenderer {
@@ -396,6 +395,7 @@
&x->value, &y->value, &radius->value));
}
+
void RecordingCanvas::drawOval(float left, float top, float right, float bottom, const SkPaint& paint) {
addOp(new (alloc()) OvalOp(
Rect(left, top, right, bottom),
@@ -422,15 +422,6 @@
refPaint(&paint), refPath(&path)));
}
-void RecordingCanvas::drawVectorDrawable(VectorDrawableRoot* tree) {
- mDisplayList->ref(tree);
- addOp(new (alloc()) VectorDrawableOp(
- tree,
- Rect(tree->getBounds()),
- *(mState.currentSnapshot()->transform),
- getRecordedClip()));
-}
-
// Bitmap-based
void RecordingCanvas::drawBitmap(const SkBitmap& bitmap, float left, float top, const SkPaint* paint) {
save(SaveFlags::Matrix);
diff --git a/libs/hwui/RecordingCanvas.h b/libs/hwui/RecordingCanvas.h
index cc14e61..375760f 100644
--- a/libs/hwui/RecordingCanvas.h
+++ b/libs/hwui/RecordingCanvas.h
@@ -175,8 +175,6 @@
const uint16_t* indices, int indexCount, const SkPaint& paint) override
{ /* RecordingCanvas does not support drawVertices(); ignore */ }
- virtual void drawVectorDrawable(VectorDrawableRoot* tree) override;
-
// Bitmap-based
virtual void drawBitmap(const SkBitmap& bitmap, float left, float top, const SkPaint* paint) override;
virtual void drawBitmap(const SkBitmap& bitmap, const SkMatrix& matrix,
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index d4588ed..bade216 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -381,6 +381,10 @@
bool childFunctorsNeedLayer = mProperties.prepareForFunctorPresence(
willHaveFunctor, functorsNeedLayer);
+ if (CC_UNLIKELY(mPositionListener.get())) {
+ mPositionListener->onPositionUpdated(*this, info);
+ }
+
prepareLayer(info, animatorDirtyMask);
if (info.mode == TreeInfo::MODE_FULL) {
pushStagingDisplayListChanges(info);
diff --git a/libs/hwui/RenderNode.h b/libs/hwui/RenderNode.h
index 8e4a3df..f248de54 100644
--- a/libs/hwui/RenderNode.h
+++ b/libs/hwui/RenderNode.h
@@ -209,6 +209,19 @@
OffscreenBuffer** getLayerHandle() { return &mLayer; } // ugh...
#endif
+ class ANDROID_API PositionListener {
+ public:
+ virtual ~PositionListener() {}
+ virtual void onPositionUpdated(RenderNode& node, const TreeInfo& info) = 0;
+ };
+
+ // Note this is not thread safe, this needs to be called
+ // before the RenderNode is used for drawing.
+ // RenderNode takes ownership of the pointer
+ ANDROID_API void setPositionListener(PositionListener* listener) {
+ mPositionListener.reset(listener);
+ }
+
private:
typedef key_value_pair_t<float, DrawRenderNodeOp*> ZDrawRenderNodeOpPair;
@@ -317,6 +330,8 @@
// This is *NOT* thread-safe, and should therefore only be tracking
// mDisplayList, not mStagingDisplayList.
uint32_t mParentCount;
+
+ std::unique_ptr<PositionListener> mPositionListener;
}; // class RenderNode
} /* namespace uirenderer */
diff --git a/libs/hwui/SkiaCanvas.cpp b/libs/hwui/SkiaCanvas.cpp
index bd4442d..d320a41 100644
--- a/libs/hwui/SkiaCanvas.cpp
+++ b/libs/hwui/SkiaCanvas.cpp
@@ -32,8 +32,6 @@
#include <SkTLazy.h>
#include <SkTemplates.h>
-#include "VectorDrawable.h"
-
#include <memory>
namespace android {
@@ -155,7 +153,6 @@
float hOffset, float vOffset, const SkPaint& paint) override;
virtual bool drawTextAbsolutePos() const override { return true; }
- virtual void drawVectorDrawable(VectorDrawableRoot* vectorDrawable) override;
virtual void drawRoundRect(uirenderer::CanvasPropertyPrimitive* left,
uirenderer::CanvasPropertyPrimitive* top, uirenderer::CanvasPropertyPrimitive* right,
@@ -745,14 +742,6 @@
NinePatch::Draw(mCanvas, bounds, bitmap, chunk, paint, nullptr);
}
-void SkiaCanvas::drawVectorDrawable(VectorDrawableRoot* vectorDrawable) {
- const SkBitmap& bitmap = vectorDrawable->getBitmapUpdateIfDirty();
- SkRect bounds = vectorDrawable->getBounds();
- drawBitmap(bitmap, 0, 0, bitmap.width(), bitmap.height(),
- bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom,
- vectorDrawable->getPaint());
-}
-
// ----------------------------------------------------------------------------
// Canvas draw operations: Text
// ----------------------------------------------------------------------------
diff --git a/libs/hwui/TreeInfo.h b/libs/hwui/TreeInfo.h
index be25516..accd303 100644
--- a/libs/hwui/TreeInfo.h
+++ b/libs/hwui/TreeInfo.h
@@ -86,6 +86,12 @@
#endif
ErrorHandler* errorHandler = nullptr;
+ // Frame number for use with synchronized surfaceview position updating
+ int64_t frameNumber = -1;
+ int32_t windowInsetLeft = 0;
+ int32_t windowInsetTop = 0;
+ bool updateWindowPositions = false;
+
struct Out {
bool hasFunctors = false;
// This is only updated if evaluateAnimations is true
diff --git a/libs/hwui/VectorDrawable.cpp b/libs/hwui/VectorDrawable.cpp
index 541c799..1cf15ac 100644
--- a/libs/hwui/VectorDrawable.cpp
+++ b/libs/hwui/VectorDrawable.cpp
@@ -138,7 +138,18 @@
}
FullPath::FullPath(const FullPath& path) : Path(path) {
- mProperties = path.mProperties;
+ mStrokeWidth = path.mStrokeWidth;
+ mStrokeColor = path.mStrokeColor;
+ mStrokeAlpha = path.mStrokeAlpha;
+ mFillColor = path.mFillColor;
+ mFillAlpha = path.mFillAlpha;
+ mTrimPathStart = path.mTrimPathStart;
+ mTrimPathEnd = path.mTrimPathEnd;
+ mTrimPathOffset = path.mTrimPathOffset;
+ mStrokeMiterLimit = path.mStrokeMiterLimit;
+ mStrokeLineCap = path.mStrokeLineCap;
+ mStrokeLineJoin = path.mStrokeLineJoin;
+
SkRefCnt_SafeAssign(mStrokeGradient, path.mStrokeGradient);
SkRefCnt_SafeAssign(mFillGradient, path.mFillGradient);
}
@@ -148,7 +159,7 @@
return mTrimmedSkPath;
}
Path::getUpdatedPath();
- if (mProperties.trimPathStart != 0.0f || mProperties.trimPathEnd != 1.0f) {
+ if (mTrimPathStart != 0.0f || mTrimPathEnd != 1.0f) {
applyTrim();
return mTrimmedSkPath;
} else {
@@ -159,14 +170,14 @@
void FullPath::updateProperties(float strokeWidth, SkColor strokeColor, float strokeAlpha,
SkColor fillColor, float fillAlpha, float trimPathStart, float trimPathEnd,
float trimPathOffset, float strokeMiterLimit, int strokeLineCap, int strokeLineJoin) {
- mProperties.strokeWidth = strokeWidth;
- mProperties.strokeColor = strokeColor;
- mProperties.strokeAlpha = strokeAlpha;
- mProperties.fillColor = fillColor;
- mProperties.fillAlpha = fillAlpha;
- mProperties.strokeMiterLimit = strokeMiterLimit;
- mProperties.strokeLineCap = strokeLineCap;
- mProperties.strokeLineJoin = strokeLineJoin;
+ mStrokeWidth = strokeWidth;
+ mStrokeColor = strokeColor;
+ mStrokeAlpha = strokeAlpha;
+ mFillColor = fillColor;
+ mFillAlpha = fillAlpha;
+ mStrokeMiterLimit = strokeMiterLimit;
+ mStrokeLineCap = SkPaint::Cap(strokeLineCap);
+ mStrokeLineJoin = SkPaint::Join(strokeLineJoin);
// If any trim property changes, mark trim dirty and update the trim path
setTrimPathStart(trimPathStart);
@@ -184,12 +195,12 @@
// Draw path's fill, if fill color or gradient is valid
bool needsFill = false;
if (mFillGradient != nullptr) {
- mPaint.setColor(applyAlpha(SK_ColorBLACK, mProperties.fillAlpha));
+ mPaint.setColor(applyAlpha(SK_ColorBLACK, mFillAlpha));
SkShader* newShader = mFillGradient->newWithLocalMatrix(matrix);
mPaint.setShader(newShader);
needsFill = true;
- } else if (mProperties.fillColor != SK_ColorTRANSPARENT) {
- mPaint.setColor(applyAlpha(mProperties.fillColor, mProperties.fillAlpha));
+ } else if (mFillColor != SK_ColorTRANSPARENT) {
+ mPaint.setColor(applyAlpha(mFillColor, mFillAlpha));
needsFill = true;
}
@@ -202,21 +213,21 @@
// Draw path's stroke, if stroke color or gradient is valid
bool needsStroke = false;
if (mStrokeGradient != nullptr) {
- mPaint.setColor(applyAlpha(SK_ColorBLACK, mProperties.strokeAlpha));
+ mPaint.setColor(applyAlpha(SK_ColorBLACK, mStrokeAlpha));
SkShader* newShader = mStrokeGradient->newWithLocalMatrix(matrix);
mPaint.setShader(newShader);
needsStroke = true;
- } else if (mProperties.strokeColor != SK_ColorTRANSPARENT) {
- mPaint.setColor(applyAlpha(mProperties.strokeColor, mProperties.strokeAlpha));
+ } else if (mStrokeColor != SK_ColorTRANSPARENT) {
+ mPaint.setColor(applyAlpha(mStrokeColor, mStrokeAlpha));
needsStroke = true;
}
if (needsStroke) {
mPaint.setStyle(SkPaint::Style::kStroke_Style);
mPaint.setAntiAlias(true);
- mPaint.setStrokeJoin(SkPaint::Join(mProperties.strokeLineJoin));
- mPaint.setStrokeCap(SkPaint::Cap(mProperties.strokeLineCap));
- mPaint.setStrokeMiter(mProperties.strokeMiterLimit);
- mPaint.setStrokeWidth(mProperties.strokeWidth * strokeScale);
+ mPaint.setStrokeJoin(mStrokeLineJoin);
+ mPaint.setStrokeCap(mStrokeLineCap);
+ mPaint.setStrokeMiter(mStrokeMiterLimit);
+ mPaint.setStrokeWidth(mStrokeWidth * strokeScale);
outCanvas->drawPath(renderPath, mPaint);
}
}
@@ -225,14 +236,14 @@
* Applies trimming to the specified path.
*/
void FullPath::applyTrim() {
- if (mProperties.trimPathStart == 0.0f && mProperties.trimPathEnd == 1.0f) {
+ if (mTrimPathStart == 0.0f && mTrimPathEnd == 1.0f) {
// No trimming necessary.
return;
}
SkPathMeasure measure(mSkPath, false);
float len = SkScalarToFloat(measure.getLength());
- float start = len * fmod((mProperties.trimPathStart + mProperties.trimPathOffset), 1.0f);
- float end = len * fmod((mProperties.trimPathEnd + mProperties.trimPathOffset), 1.0f);
+ float start = len * fmod((mTrimPathStart + mTrimPathOffset), 1.0f);
+ float end = len * fmod((mTrimPathEnd + mTrimPathOffset), 1.0f);
mTrimmedSkPath.reset();
if (start > end) {
@@ -244,69 +255,76 @@
mTrimDirty = false;
}
-REQUIRE_COMPATIBLE_LAYOUT(FullPath::Properties);
+inline int putData(int8_t* outBytes, int startIndex, float value) {
+ int size = sizeof(float);
+ memcpy(&outBytes[startIndex], &value, size);
+ return size;
+}
+
+inline int putData(int8_t* outBytes, int startIndex, int value) {
+ int size = sizeof(int);
+ memcpy(&outBytes[startIndex], &value, size);
+ return size;
+}
+
+struct FullPathProperties {
+ // TODO: Consider storing full path properties in this struct instead of the fields.
+ float strokeWidth;
+ SkColor strokeColor;
+ float strokeAlpha;
+ SkColor fillColor;
+ float fillAlpha;
+ float trimPathStart;
+ float trimPathEnd;
+ float trimPathOffset;
+ int32_t strokeLineCap;
+ int32_t strokeLineJoin;
+ float strokeMiterLimit;
+};
+
+REQUIRE_COMPATIBLE_LAYOUT(FullPathProperties);
static_assert(sizeof(float) == sizeof(int32_t), "float is not the same size as int32_t");
static_assert(sizeof(SkColor) == sizeof(int32_t), "SkColor is not the same size as int32_t");
bool FullPath::getProperties(int8_t* outProperties, int length) {
- int propertyDataSize = sizeof(Properties);
+ int propertyDataSize = sizeof(FullPathProperties);
if (length != propertyDataSize) {
LOG_ALWAYS_FATAL("Properties needs exactly %d bytes, a byte array of size %d is provided",
propertyDataSize, length);
return false;
}
- Properties* out = reinterpret_cast<Properties*>(outProperties);
- *out = mProperties;
+ // TODO: consider replacing the property fields with a FullPathProperties struct.
+ FullPathProperties properties;
+ properties.strokeWidth = mStrokeWidth;
+ properties.strokeColor = mStrokeColor;
+ properties.strokeAlpha = mStrokeAlpha;
+ properties.fillColor = mFillColor;
+ properties.fillAlpha = mFillAlpha;
+ properties.trimPathStart = mTrimPathStart;
+ properties.trimPathEnd = mTrimPathEnd;
+ properties.trimPathOffset = mTrimPathOffset;
+ properties.strokeLineCap = mStrokeLineCap;
+ properties.strokeLineJoin = mStrokeLineJoin;
+ properties.strokeMiterLimit = mStrokeMiterLimit;
+
+ memcpy(outProperties, &properties, length);
return true;
}
-void FullPath::setColorPropertyValue(int propertyId, int32_t value) {
- Property currentProperty = static_cast<Property>(propertyId);
- if (currentProperty == Property::StrokeColor) {
- mProperties.strokeColor = value;
- } else if (currentProperty == Property::FillColor) {
- mProperties.fillColor = value;
- } else {
- LOG_ALWAYS_FATAL("Error setting color property on FullPath: No valid property with id: %d",
- propertyId);
- }
-}
-
-void FullPath::setPropertyValue(int propertyId, float value) {
- Property property = static_cast<Property>(propertyId);
- switch (property) {
- case Property::StrokeWidth:
- setStrokeWidth(value);
- break;
- case Property::StrokeAlpha:
- setStrokeAlpha(value);
- break;
- case Property::FillAlpha:
- setFillAlpha(value);
- break;
- case Property::TrimPathStart:
- setTrimPathStart(value);
- break;
- case Property::TrimPathEnd:
- setTrimPathEnd(value);
- break;
- case Property::TrimPathOffset:
- setTrimPathOffset(value);
- break;
- default:
- LOG_ALWAYS_FATAL("Invalid property id: %d for animation", propertyId);
- break;
- }
-}
-
void ClipPath::drawPath(SkCanvas* outCanvas, const SkPath& renderPath,
float strokeScale, const SkMatrix& matrix){
outCanvas->clipPath(renderPath, SkRegion::kIntersect_Op);
}
Group::Group(const Group& group) : Node(group) {
- mProperties = group.mProperties;
+ mRotate = group.mRotate;
+ mPivotX = group.mPivotX;
+ mPivotY = group.mPivotY;
+ mScaleX = group.mScaleX;
+ mScaleY = group.mScaleY;
+ mTranslateX = group.mTranslateX;
+ mTranslateY = group.mTranslateY;
}
void Group::draw(SkCanvas* outCanvas, const SkMatrix& currentMatrix, float scaleX,
@@ -353,11 +371,10 @@
outMatrix->reset();
// TODO: use rotate(mRotate, mPivotX, mPivotY) and scale with pivot point, instead of
// translating to pivot for rotating and scaling, then translating back.
- outMatrix->postTranslate(-mProperties.pivotX, -mProperties.pivotY);
- outMatrix->postScale(mProperties.scaleX, mProperties.scaleY);
- outMatrix->postRotate(mProperties.rotate, 0, 0);
- outMatrix->postTranslate(mProperties.translateX + mProperties.pivotX,
- mProperties.translateY + mProperties.pivotY);
+ outMatrix->postTranslate(-mPivotX, -mPivotY);
+ outMatrix->postScale(mScaleX, mScaleY);
+ outMatrix->postRotate(mRotate, 0, 0);
+ outMatrix->postTranslate(mTranslateX + mPivotX, mTranslateY + mPivotY);
}
void Group::addChild(Node* child) {
@@ -371,68 +388,38 @@
propertyCount, length);
return false;
}
- Properties* out = reinterpret_cast<Properties*>(outProperties);
- *out = mProperties;
+ for (int i = 0; i < propertyCount; i++) {
+ Property currentProperty = static_cast<Property>(i);
+ switch (currentProperty) {
+ case Property::Rotate_Property:
+ outProperties[i] = mRotate;
+ break;
+ case Property::PivotX_Property:
+ outProperties[i] = mPivotX;
+ break;
+ case Property::PivotY_Property:
+ outProperties[i] = mPivotY;
+ break;
+ case Property::ScaleX_Property:
+ outProperties[i] = mScaleX;
+ break;
+ case Property::ScaleY_Property:
+ outProperties[i] = mScaleY;
+ break;
+ case Property::TranslateX_Property:
+ outProperties[i] = mTranslateX;
+ break;
+ case Property::TranslateY_Property:
+ outProperties[i] = mTranslateY;
+ break;
+ default:
+ LOG_ALWAYS_FATAL("Invalid input index: %d", i);
+ return false;
+ }
+ }
return true;
}
-// TODO: Consider animating the properties as float pointers
-float Group::getPropertyValue(int propertyId) const {
- Property currentProperty = static_cast<Property>(propertyId);
- switch (currentProperty) {
- case Property::Rotate:
- return mProperties.rotate;
- case Property::PivotX:
- return mProperties.pivotX;
- case Property::PivotY:
- return mProperties.pivotY;
- case Property::ScaleX:
- return mProperties.scaleX;
- case Property::ScaleY:
- return mProperties.scaleY;
- case Property::TranslateX:
- return mProperties.translateX;
- case Property::TranslateY:
- return mProperties.translateY;
- default:
- LOG_ALWAYS_FATAL("Invalid property index: %d", propertyId);
- return 0;
- }
-}
-
-void Group::setPropertyValue(int propertyId, float value) {
- Property currentProperty = static_cast<Property>(propertyId);
- switch (currentProperty) {
- case Property::Rotate:
- mProperties.rotate = value;
- break;
- case Property::PivotX:
- mProperties.pivotX = value;
- break;
- case Property::PivotY:
- mProperties.pivotY = value;
- break;
- case Property::ScaleX:
- mProperties.scaleX = value;
- break;
- case Property::ScaleY:
- mProperties.scaleY = value;
- break;
- case Property::TranslateX:
- mProperties.translateX = value;
- break;
- case Property::TranslateY:
- mProperties.translateY = value;
- break;
- default:
- LOG_ALWAYS_FATAL("Invalid property index: %d", propertyId);
- }
-}
-
-bool Group::isValidProperty(int propertyId) {
- return propertyId >= 0 && propertyId < static_cast<int>(Property::Count);
-}
-
void Tree::draw(Canvas* outCanvas, SkColorFilter* colorFilter,
const SkRect& bounds, bool needsMirroring, bool canReuseCache) {
// The imageView can scale the canvas in different ways, in order to
@@ -458,8 +445,6 @@
return;
}
- mPaint.setColorFilter(colorFilter);
-
int saveCount = outCanvas->save(SaveFlags::MatrixClip);
outCanvas->translate(mBounds.fLeft, mBounds.fTop);
@@ -473,33 +458,43 @@
// And we use this bound for the destination rect for the drawBitmap, so
// we offset to (0, 0);
mBounds.offsetTo(0, 0);
- createCachedBitmapIfNeeded(scaledWidth, scaledHeight);
- outCanvas->drawVectorDrawable(this);
+ createCachedBitmapIfNeeded(scaledWidth, scaledHeight);
+ if (!mAllowCaching) {
+ updateCachedBitmap(scaledWidth, scaledHeight);
+ } else {
+ if (!canReuseCache || mCacheDirty) {
+ updateCachedBitmap(scaledWidth, scaledHeight);
+ }
+ }
+ drawCachedBitmapWithRootAlpha(outCanvas, colorFilter, mBounds);
outCanvas->restoreToCount(saveCount);
}
-SkPaint* Tree::getPaint() {
+void Tree::drawCachedBitmapWithRootAlpha(Canvas* outCanvas, SkColorFilter* filter,
+ const SkRect& originalBounds) {
SkPaint* paint;
- if (mRootAlpha == 1.0f && mPaint.getColorFilter() == NULL) {
+ if (mRootAlpha == 1.0f && filter == NULL) {
paint = NULL;
} else {
mPaint.setFilterQuality(kLow_SkFilterQuality);
mPaint.setAlpha(mRootAlpha * 255);
+ mPaint.setColorFilter(filter);
paint = &mPaint;
}
- return paint;
+ outCanvas->drawBitmap(mCachedBitmap, 0, 0, mCachedBitmap.width(), mCachedBitmap.height(),
+ originalBounds.fLeft, originalBounds.fTop, originalBounds.fRight,
+ originalBounds.fBottom, paint);
}
-const SkBitmap& Tree::getBitmapUpdateIfDirty() {
+void Tree::updateCachedBitmap(int width, int height) {
mCachedBitmap.eraseColor(SK_ColorTRANSPARENT);
SkCanvas outCanvas(mCachedBitmap);
- float scaleX = (float) mCachedBitmap.width() / mViewportWidth;
- float scaleY = (float) mCachedBitmap.height() / mViewportHeight;
+ float scaleX = width / mViewportWidth;
+ float scaleY = height / mViewportHeight;
mRootNode->draw(&outCanvas, SkMatrix::I(), scaleX, scaleY);
mCacheDirty = false;
- return mCachedBitmap;
}
void Tree::createCachedBitmapIfNeeded(int width, int height) {
diff --git a/libs/hwui/VectorDrawable.h b/libs/hwui/VectorDrawable.h
index f8f1ea6..09bdce5 100644
--- a/libs/hwui/VectorDrawable.h
+++ b/libs/hwui/VectorDrawable.h
@@ -18,7 +18,6 @@
#define ANDROID_HWUI_VPATH_H
#include "Canvas.h"
-
#include <SkBitmap.h>
#include <SkColor.h>
#include <SkCanvas.h>
@@ -105,21 +104,6 @@
class ANDROID_API FullPath: public Path {
public:
-
-struct Properties {
- float strokeWidth = 0;
- SkColor strokeColor = SK_ColorTRANSPARENT;
- float strokeAlpha = 1;
- SkColor fillColor = SK_ColorTRANSPARENT;
- float fillAlpha = 1;
- float trimPathStart = 0;
- float trimPathEnd = 1;
- float trimPathOffset = 0;
- int32_t strokeLineCap = SkPaint::Cap::kButt_Cap;
- int32_t strokeLineJoin = SkPaint::Join::kMiter_Join;
- float strokeMiterLimit = 4;
-};
-
FullPath(const FullPath& path); // for cloning
FullPath(const char* path, size_t strLength) : Path(path, strLength) {}
FullPath() : Path() {}
@@ -134,58 +118,55 @@
float strokeAlpha, SkColor fillColor, float fillAlpha,
float trimPathStart, float trimPathEnd, float trimPathOffset,
float strokeMiterLimit, int strokeLineCap, int strokeLineJoin);
- // TODO: Cleanup: Remove the setter and getters below, and their counterparts in java and JNI
float getStrokeWidth() {
- return mProperties.strokeWidth;
+ return mStrokeWidth;
}
void setStrokeWidth(float strokeWidth) {
- mProperties.strokeWidth = strokeWidth;
+ mStrokeWidth = strokeWidth;
}
SkColor getStrokeColor() {
- return mProperties.strokeColor;
+ return mStrokeColor;
}
void setStrokeColor(SkColor strokeColor) {
- mProperties.strokeColor = strokeColor;
+ mStrokeColor = strokeColor;
}
float getStrokeAlpha() {
- return mProperties.strokeAlpha;
+ return mStrokeAlpha;
}
void setStrokeAlpha(float strokeAlpha) {
- mProperties.strokeAlpha = strokeAlpha;
+ mStrokeAlpha = strokeAlpha;
}
SkColor getFillColor() {
- return mProperties.fillColor;
+ return mFillColor;
}
void setFillColor(SkColor fillColor) {
- mProperties.fillColor = fillColor;
+ mFillColor = fillColor;
}
float getFillAlpha() {
- return mProperties.fillAlpha;
+ return mFillAlpha;
}
void setFillAlpha(float fillAlpha) {
- mProperties.fillAlpha = fillAlpha;
+ mFillAlpha = fillAlpha;
}
float getTrimPathStart() {
- return mProperties.trimPathStart;
+ return mTrimPathStart;
}
void setTrimPathStart(float trimPathStart) {
- VD_SET_PROP_WITH_FLAG(mProperties.trimPathStart, trimPathStart, mTrimDirty);
+ VD_SET_PROP_WITH_FLAG(mTrimPathStart, trimPathStart, mTrimDirty);
}
float getTrimPathEnd() {
- return mProperties.trimPathEnd;
+ return mTrimPathEnd;
}
void setTrimPathEnd(float trimPathEnd) {
- VD_SET_PROP_WITH_FLAG(mProperties.trimPathEnd, trimPathEnd, mTrimDirty);
+ VD_SET_PROP_WITH_FLAG(mTrimPathEnd, trimPathEnd, mTrimDirty);
}
float getTrimPathOffset() {
- return mProperties.trimPathOffset;
+ return mTrimPathOffset;
}
void setTrimPathOffset(float trimPathOffset) {
- VD_SET_PROP_WITH_FLAG(mProperties.trimPathOffset, trimPathOffset, mTrimDirty);
+ VD_SET_PROP_WITH_FLAG(mTrimPathOffset, trimPathOffset, mTrimDirty);
}
bool getProperties(int8_t* outProperties, int length);
- void setColorPropertyValue(int propertyId, int32_t value);
- void setPropertyValue(int propertyId, float value);
void setFillGradient(SkShader* fillGradient) {
SkRefCnt_SafeAssign(mFillGradient, fillGradient);
@@ -201,28 +182,24 @@
float strokeScale, const SkMatrix& matrix) override;
private:
- enum class Property {
- StrokeWidth = 0,
- StrokeColor,
- StrokeAlpha,
- FillColor,
- FillAlpha,
- TrimPathStart,
- TrimPathEnd,
- TrimPathOffset,
- StrokeLineCap,
- StrokeLineJoin,
- StrokeMiterLimit,
- Count,
- };
// Applies trimming to the specified path.
void applyTrim();
- Properties mProperties;
- bool mTrimDirty = true;
- SkPath mTrimmedSkPath;
- SkPaint mPaint;
+ float mStrokeWidth = 0;
+ SkColor mStrokeColor = SK_ColorTRANSPARENT;
+ float mStrokeAlpha = 1;
+ SkColor mFillColor = SK_ColorTRANSPARENT;
SkShader* mStrokeGradient = nullptr;
SkShader* mFillGradient = nullptr;
+ float mFillAlpha = 1;
+ float mTrimPathStart = 0;
+ float mTrimPathEnd = 1;
+ float mTrimPathOffset = 0;
+ bool mTrimDirty = true;
+ SkPaint::Cap mStrokeLineCap = SkPaint::Cap::kButt_Cap;
+ SkPaint::Join mStrokeLineJoin = SkPaint::Join::kMiter_Join;
+ float mStrokeMiterLimit = 4;
+ SkPath mTrimmedSkPath;
+ SkPaint mPaint;
};
class ANDROID_API ClipPath: public Path {
@@ -239,58 +216,49 @@
class ANDROID_API Group: public Node {
public:
- struct Properties {
- float rotate = 0;
- float pivotX = 0;
- float pivotY = 0;
- float scaleX = 1;
- float scaleY = 1;
- float translateX = 0;
- float translateY = 0;
- };
Group(const Group& group);
Group() {}
float getRotation() {
- return mProperties.rotate;
+ return mRotate;
}
void setRotation(float rotation) {
- mProperties.rotate = rotation;
+ mRotate = rotation;
}
float getPivotX() {
- return mProperties.pivotX;
+ return mPivotX;
}
void setPivotX(float pivotX) {
- mProperties.pivotX = pivotX;
+ mPivotX = pivotX;
}
float getPivotY() {
- return mProperties.pivotY;
+ return mPivotY;
}
void setPivotY(float pivotY) {
- mProperties.pivotY = pivotY;
+ mPivotY = pivotY;
}
float getScaleX() {
- return mProperties.scaleX;
+ return mScaleX;
}
void setScaleX(float scaleX) {
- mProperties.scaleX = scaleX;
+ mScaleX = scaleX;
}
float getScaleY() {
- return mProperties.scaleY;
+ return mScaleY;
}
void setScaleY(float scaleY) {
- mProperties.scaleY = scaleY;
+ mScaleY = scaleY;
}
float getTranslateX() {
- return mProperties.translateX;
+ return mTranslateX;
}
void setTranslateX(float translateX) {
- mProperties.translateX = translateX;
+ mTranslateX = translateX;
}
float getTranslateY() {
- return mProperties.translateY;
+ return mTranslateY;
}
void setTranslateY(float translateY) {
- mProperties.translateY = translateY;
+ mTranslateY = translateY;
}
virtual void draw(SkCanvas* outCanvas, const SkMatrix& currentMatrix,
float scaleX, float scaleY) override;
@@ -300,33 +268,38 @@
void addChild(Node* child);
void dump() override;
bool getProperties(float* outProperties, int length);
- float getPropertyValue(int propertyId) const;
- void setPropertyValue(int propertyId, float value);
- static bool isValidProperty(int propertyId);
private:
enum class Property {
- Rotate = 0,
- PivotX,
- PivotY,
- ScaleX,
- ScaleY,
- TranslateX,
- TranslateY,
+ Rotate_Property = 0,
+ PivotX_Property,
+ PivotY_Property,
+ ScaleX_Property,
+ ScaleY_Property,
+ TranslateX_Property,
+ TranslateY_Property,
// Count of the properties, must be at the end.
Count,
};
+ float mRotate = 0;
+ float mPivotX = 0;
+ float mPivotY = 0;
+ float mScaleX = 1;
+ float mScaleY = 1;
+ float mTranslateX = 0;
+ float mTranslateY = 0;
std::vector<Node*> mChildren;
- Properties mProperties;
};
-class ANDROID_API Tree : public VirtualLightRefBase {
+class ANDROID_API Tree {
public:
Tree(Group* rootNode) : mRootNode(rootNode) {}
void draw(Canvas* outCanvas, SkColorFilter* colorFilter,
const SkRect& bounds, bool needsMirroring, bool canReuseCache);
+ void drawCachedBitmapWithRootAlpha(Canvas* outCanvas, SkColorFilter* filter,
+ const SkRect& originalBounds);
- const SkBitmap& getBitmapUpdateIfDirty();
+ void updateCachedBitmap(int width, int height);
void createCachedBitmapIfNeeded(int width, int height);
bool canReuseBitmap(int width, int height);
void setAllowCaching(bool allowCaching) {
@@ -343,10 +316,6 @@
mViewportWidth = viewportWidth;
mViewportHeight = viewportHeight;
}
- SkPaint* getPaint();
- const SkRect& getBounds() const {
- return mBounds;
- }
private:
// Cap the bitmap size, such that it won't hurt the performance too much
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index d411621..ea702c0 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -92,18 +92,18 @@
}
}
-void CanvasContext::setSurface(ANativeWindow* window) {
+void CanvasContext::setSurface(Surface* surface) {
ATRACE_CALL();
- mNativeWindow = window;
+ mNativeSurface = surface;
if (mEglSurface != EGL_NO_SURFACE) {
mEglManager.destroySurface(mEglSurface);
mEglSurface = EGL_NO_SURFACE;
}
- if (window) {
- mEglSurface = mEglManager.createSurface(window);
+ if (surface) {
+ mEglSurface = mEglManager.createSurface(surface);
}
if (mEglSurface != EGL_NO_SURFACE) {
@@ -127,8 +127,8 @@
mSwapBehavior = swapBehavior;
}
-void CanvasContext::initialize(ANativeWindow* window) {
- setSurface(window);
+void CanvasContext::initialize(Surface* surface) {
+ setSurface(surface);
#if !HWUI_NEW_OPS
if (mCanvas) return;
mCanvas = new OpenGLRenderer(mRenderThread.renderState());
@@ -136,11 +136,11 @@
#endif
}
-void CanvasContext::updateSurface(ANativeWindow* window) {
- setSurface(window);
+void CanvasContext::updateSurface(Surface* surface) {
+ setSurface(surface);
}
-bool CanvasContext::pauseSurface(ANativeWindow* window) {
+bool CanvasContext::pauseSurface(Surface* surface) {
return mRenderThread.removeFrameCallback(this);
}
@@ -204,6 +204,10 @@
info.renderer = mCanvas;
#endif
+ if (CC_LIKELY(mNativeSurface.get())) {
+ info.frameNumber = static_cast<int64_t>(mNativeSurface->getNextFrameNumber());
+ }
+
mAnimationContext->startFrame(info.mode);
for (const sp<RenderNode>& node : mRenderNodes) {
// Only the primary target node will be drawn full - all other nodes would get drawn in
@@ -219,7 +223,7 @@
freePrefetechedLayers();
GL_CHECKPOINT(MODERATE);
- if (CC_UNLIKELY(!mNativeWindow.get())) {
+ if (CC_UNLIKELY(!mNativeSurface.get())) {
mCurrentFrameInfo->addFlag(FrameInfoFlags::SkippedFrame);
info.out.canDrawThisFrame = false;
return;
@@ -242,8 +246,9 @@
} else {
// We're maybe behind? Find out for sure
int runningBehind = 0;
- mNativeWindow->query(mNativeWindow.get(),
- NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND, &runningBehind);
+ // TODO: Have this method be on Surface, too, not just ANativeWindow...
+ ANativeWindow* window = mNativeSurface.get();
+ window->query(window, NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND, &runningBehind);
info.out.canDrawThisFrame = !runningBehind;
}
} else {
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index 63a7977..168166e 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -39,6 +39,7 @@
#include <SkBitmap.h>
#include <SkRect.h>
#include <utils/Functor.h>
+#include <gui/Surface.h>
#include <set>
#include <string>
@@ -75,10 +76,10 @@
// Won't take effect until next EGLSurface creation
void setSwapBehavior(SwapBehavior swapBehavior);
- void initialize(ANativeWindow* window);
- void updateSurface(ANativeWindow* window);
- bool pauseSurface(ANativeWindow* window);
- bool hasSurface() { return mNativeWindow.get(); }
+ void initialize(Surface* surface);
+ void updateSurface(Surface* surface);
+ bool pauseSurface(Surface* surface);
+ bool hasSurface() { return mNativeSurface.get(); }
void setup(int width, int height, float lightRadius,
uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha);
@@ -172,7 +173,7 @@
// lifecycle tracking
friend class android::uirenderer::RenderState;
- void setSurface(ANativeWindow* window);
+ void setSurface(Surface* window);
void requireSurface();
void freePrefetechedLayers();
@@ -182,7 +183,7 @@
RenderThread& mRenderThread;
EglManager& mEglManager;
- sp<ANativeWindow> mNativeWindow;
+ sp<Surface> mNativeSurface;
EGLSurface mEglSurface = EGL_NO_SURFACE;
bool mBufferPreserved = false;
SwapBehavior mSwapBehavior = kSwap_default;
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index 1d1b144..7c6cd7e 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -139,38 +139,38 @@
postAndWait(task); // block since name/value pointers owned by caller
}
-CREATE_BRIDGE2(initialize, CanvasContext* context, ANativeWindow* window) {
- args->context->initialize(args->window);
+CREATE_BRIDGE2(initialize, CanvasContext* context, Surface* surface) {
+ args->context->initialize(args->surface);
return nullptr;
}
-void RenderProxy::initialize(const sp<ANativeWindow>& window) {
+void RenderProxy::initialize(const sp<Surface>& surface) {
SETUP_TASK(initialize);
args->context = mContext;
- args->window = window.get();
+ args->surface = surface.get();
post(task);
}
-CREATE_BRIDGE2(updateSurface, CanvasContext* context, ANativeWindow* window) {
- args->context->updateSurface(args->window);
+CREATE_BRIDGE2(updateSurface, CanvasContext* context, Surface* surface) {
+ args->context->updateSurface(args->surface);
return nullptr;
}
-void RenderProxy::updateSurface(const sp<ANativeWindow>& window) {
+void RenderProxy::updateSurface(const sp<Surface>& surface) {
SETUP_TASK(updateSurface);
args->context = mContext;
- args->window = window.get();
+ args->surface = surface.get();
postAndWait(task);
}
-CREATE_BRIDGE2(pauseSurface, CanvasContext* context, ANativeWindow* window) {
- return (void*) args->context->pauseSurface(args->window);
+CREATE_BRIDGE2(pauseSurface, CanvasContext* context, Surface* surface) {
+ return (void*) args->context->pauseSurface(args->surface);
}
-bool RenderProxy::pauseSurface(const sp<ANativeWindow>& window) {
+bool RenderProxy::pauseSurface(const sp<Surface>& surface) {
SETUP_TASK(pauseSurface);
args->context = mContext;
- args->window = window.get();
+ args->surface = surface.get();
return (bool) postAndWait(task);
}
diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h
index 4180d802..178724a 100644
--- a/libs/hwui/renderthread/RenderProxy.h
+++ b/libs/hwui/renderthread/RenderProxy.h
@@ -67,9 +67,9 @@
ANDROID_API bool loadSystemProperties();
ANDROID_API void setName(const char* name);
- ANDROID_API void initialize(const sp<ANativeWindow>& window);
- ANDROID_API void updateSurface(const sp<ANativeWindow>& window);
- ANDROID_API bool pauseSurface(const sp<ANativeWindow>& window);
+ ANDROID_API void initialize(const sp<Surface>& surface);
+ ANDROID_API void updateSurface(const sp<Surface>& surface);
+ ANDROID_API bool pauseSurface(const sp<Surface>& surface);
ANDROID_API void setup(int width, int height, float lightRadius,
uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha);
ANDROID_API void setLightCenter(const Vector3& lightCenter);
diff --git a/media/java/android/media/browse/MediaBrowser.java b/media/java/android/media/browse/MediaBrowser.java
index 80b3ffc..56b2514 100644
--- a/media/java/android/media/browse/MediaBrowser.java
+++ b/media/java/android/media/browse/MediaBrowser.java
@@ -117,6 +117,9 @@
* to the media browse service when connecting and retrieving the root id
* for browsing, or null if none. The contents of this bundle may affect
* the information returned when browsing.
+ * @see android.service.media.MediaBrowserService.BrowserRoot#EXTRA_RECENT
+ * @see android.service.media.MediaBrowserService.BrowserRoot#EXTRA_OFFLINE
+ * @see android.service.media.MediaBrowserService.BrowserRoot#EXTRA_SUGGESTED
*/
public MediaBrowser(Context context, ComponentName serviceComponent,
ConnectionCallback callback, Bundle rootHints) {
diff --git a/media/java/android/service/media/MediaBrowserService.java b/media/java/android/service/media/MediaBrowserService.java
index 0393c94..3372524 100644
--- a/media/java/android/service/media/MediaBrowserService.java
+++ b/media/java/android/service/media/MediaBrowserService.java
@@ -351,6 +351,9 @@
* root id for browsing, or null if none. The contents of this
* bundle may affect the information returned when browsing.
* @return The {@link BrowserRoot} for accessing this app's content or null.
+ * @see BrowserRoot#EXTRA_RECENT
+ * @see BrowserRoot#EXTRA_OFFLINE
+ * @see BrowserRoot#EXTRA_SUGGESTED
*/
public abstract @Nullable BrowserRoot onGetRoot(@NonNull String clientPackageName,
int clientUid, @Nullable Bundle rootHints);
@@ -667,6 +670,57 @@
* when first connected.
*/
public static final class BrowserRoot {
+ /**
+ * The lookup key for a boolean that indicates whether the browser service should return a
+ * browser root for recently played media items.
+ *
+ * <p>When creating a media browser for a given media browser service, this key can be
+ * supplied as a root hint for retrieving media items that are recently played.
+ * If the media browser service can provide such media items, the implementation must return
+ * the key in the root hint when {@link #onGetRoot(String, int, Bundle)} is called back.
+ *
+ * <p>The root hint may contain multiple keys.
+ *
+ * @see #EXTRA_OFFLINE
+ * @see #EXTRA_SUGGESTED
+ */
+ public static final String EXTRA_RECENT = "android.service.media.extra.RECENT";
+
+ /**
+ * The lookup key for a boolean that indicates whether the browser service should return a
+ * browser root for offline media items.
+ *
+ * <p>When creating a media browser for a given media browser service, this key can be
+ * supplied as a root hint for retrieving media items that are can be played without an
+ * internet connection.
+ * If the media browser service can provide such media items, the implementation must return
+ * the key in the root hint when {@link #onGetRoot(String, int, Bundle)} is called back.
+ *
+ * <p>The root hint may contain multiple keys.
+ *
+ * @see #EXTRA_RECENT
+ * @see #EXTRA_SUGGESTED
+ */
+ public static final String EXTRA_OFFLINE = "android.service.media.extra.OFFLINE";
+
+ /**
+ * The lookup key for a boolean that indicates whether the browser service should return a
+ * browser root for suggested media items.
+ *
+ * <p>When creating a media browser for a given media browser service, this key can be
+ * supplied as a root hint for retrieving the media items suggested by the media browser
+ * service. The list of media items passed in {@link android.media.browse.MediaBrowser.SubscriptionCallback#onChildrenLoaded(String, List)}
+ * is considered ordered by relevance, first being the top suggestion.
+ * If the media browser service can provide such media items, the implementation must return
+ * the key in the root hint when {@link #onGetRoot(String, int, Bundle)} is called back.
+ *
+ * <p>The root hint may contain multiple keys.
+ *
+ * @see #EXTRA_RECENT
+ * @see #EXTRA_OFFLINE
+ */
+ public static final String EXTRA_SUGGESTED = "android.service.media.extra.SUGGESTED";
+
final private String mRootId;
final private Bundle mExtras;
diff --git a/packages/DocumentsUI/res/drawable/cabinet.png b/packages/DocumentsUI/res/drawable/cabinet.png
deleted file mode 100644
index da44023..0000000
--- a/packages/DocumentsUI/res/drawable/cabinet.png
+++ /dev/null
Binary files differ
diff --git a/packages/DocumentsUI/res/drawable/cabinet.xml b/packages/DocumentsUI/res/drawable/cabinet.xml
new file mode 100644
index 0000000..843ffc7
--- /dev/null
+++ b/packages/DocumentsUI/res/drawable/cabinet.xml
@@ -0,0 +1,81 @@
+<!--
+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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="672dp"
+ android:height="921dp"
+ android:viewportWidth="672.0"
+ android:viewportHeight="921.0">
+ <path
+ android:pathData="M286,0c5,0,10,0,15,0c0.1,1.8,1.5,1.8,2.8,2.1c11.1,2,22.1,4,33.2,6.1c31.8,6.1,63.7,12.3,95.5,18.5 c16.1,3.1,32.1,6.2,48.2,9.3c26,4.9,52.1,9.3,78,14.6c10.8,2.2,21.6,4.6,32.3,6.5c11.3,2,22.6,4.7,34,6c7.9,0.9,7.9,1.1,7.9,9.2 c0,237.3,0,474.5,0,711.8c-1.5,0.9,-3,2,-4.6,2.8c-18.3,8.3,-36.6,16.6,-54.8,25c-29.3,13.4,-58.5,26.8,-87.8,40.3 c-23.5,10.9,-47,21.8,-70.4,32.8c-2.1,1,-4.2,1.5,-6.3,1.1c-6.8,-1.3,-13.6,-2.5,-20.1,-4.9c5.9,-0.3,11.4,1.9,17.1,2.9c5.9,1.1,5.9,1,5.9,-4.9 c0,-17.1,0.1,-34.3,0,-51.4c-0.3,-68.9,-0.7,-137.8,-1,-206.7c0,-35.8,0,-71.6,0.1,-107.4c0,-3.8,-0.6,-5.2,-4.7,-3.7c-7.9,2.9,-16,5.4,-24.1,7.8 c-14.1,4.3,-27.8,10,-42.2,13.2c0,-64,0,-127.9,-0.1,-191.9c0,-4.1,1.3,-5.9,5.1,-7c21,-6.6,42,-13.4,63,-20.2c2.3,-0.8,4.4,-1.8,4,-4.9 c0,-59.3,0,-118.7,0,-178c0,-1.3,-0.7,-2,-2,-2c-2.6,-0.4,-5.2,-0.7,-7.8,-1.2c-30.2,-5.3,-60.5,-10.6,-90.7,-16c-31.9,-5.6,-63.7,-11.3,-95.6,-16.9 c-24.9,-4.4,-49.8,-8.7,-74.6,-13.1C117.1,75.6,93.1,71.3,69,67c-0.3,-0.3,-0.7,-0.7,-1,-1c17.4,-5.3,34.8,-10.7,52.3,-15.9 c29.4,-8.7,58.8,-17.2,88.2,-25.8c24.3,-7.1,48.6,-14.2,72.9,-21.4C283.1,2.4,285.6,2.7,286,0z"
+ android:fillColor="#EFEFEE"/>
+ <path
+ android:pathData="M412,307c0.4,3,-1.7,4.1,-4,4.9c-21,6.8,-42,13.6,-63,20.2c-3.8,1.2,-5.1,3,-5.1,7C340,403.1,340,467,340,531 c-11.8,-1.2,-23.3,-4.5,-34.9,-6.5c-10,-1.7,-19.9,-4.6,-30.1,-5.5c-0.7,-0.3,-1.4,-0.9,-2.2,-1c-19.8,-4,-39.5,-8,-59.3,-12c-12.2,-2.4,-24.3,-4.7,-36.5,-7 c-0.9,-0.3,-1.8,-0.8,-2.8,-1c-24.5,-4.9,-48.9,-9.9,-73.5,-14.6C89.3,481.3,78,477.1,66,478c-0.7,-1.6,-2.1,-1.8,-3.6,-2.1 c-11.1,-2.2,-22.2,-4.7,-33.3,-6.7c-9.7,-1.7,-19.1,-4.9,-29.1,-5.3c0,-64.3,0,-128.7,0,-193c0.8,-0.2,1.6,-0.4,2.4,-0.7c19,-7.8,37.9,-15.9,57.1,-23.4 c5.4,-2.1,6.7,-4.8,6.6,-10.2c-0.2,-55.1,-0.1,-110.2,-0.1,-165.4c0,-1.9,-1.4,-4.6,1.9,-5.4c0.3,0.3,0.7,0.7,1,1c-1.3,4.9,-1,9.9,-1,14.9 c0,51.1,0,102.3,0,153.4c0,1.2,0,2.3,0,3.5c0.1,3.5,1.2,5.9,5.3,6.5c7,1.1,14,2.6,21,3.9c22.1,4.3,44.1,8.6,66.2,12.8 c27.3,5.2,54.6,10.1,81.9,15.3c21.8,4.1,43.5,8.5,65.2,12.6c28.1,5.4,56.2,10.8,84.3,15.8C398.4,306.8,405.1,310.5,412,307z M105,329c0,3.3,0,6.7,-0.1,10c-0.1,2.5,0.4,3.6,3.4,4.2c30,5.3,59.9,10.9,89.8,16.5c3.4,0.6,5.1,0.2,4.9,-3.7 c-0.2,-3.3,-0.1,-6.7,-0.1,-10c0.5,-3.6,-0.1,-6.3,-4.7,-6.1c-1.1,0.1,-2.2,-0.6,-3.4,-0.8c-28.3,-5,-56.6,-9.9,-84.9,-14.9 C105.6,323.4,104.5,325.2,105,329z M65.9,280.8c13.7,2.5,27.4,4.9,41.1,7.4c32.6,5.9,65.2,11.8,97.8,17.8 c41.4,7.6,82.8,15.2,124.2,22.8c6.8,1.2,13.3,1.4,20,-1.3c9.3,-3.6,18.9,-6.3,28.4,-9.4c6.4,-2.1,12.8,-4.2,19.2,-6.4 c-4.2,-2,-8.3,-3,-12.4,-3.8c-22.6,-4.2,-45.3,-8,-67.9,-12.6c-14.6,-3,-29.2,-5.6,-43.8,-8.5c-24,-4.6,-48,-9.2,-72,-13.7c-15.9,-3,-31.8,-6.2,-47.8,-9.2 c-19,-3.6,-38,-7.3,-57,-10.6c-9.9,-1.7,-19.6,-4.5,-29.7,-5.2C48,255.6,30.1,263,12.2,270.4c0,0.4,0,0.7,0,1.1 C30.1,274.6,48,277.7,65.9,280.8z"
+ android:fillColor="#EAEAEA"/>
+ <path
+ android:pathData="M672,782c-6,0.9,-11.1,4.3,-16.4,6.9c-30.8,15,-61.5,30.3,-92.3,45.4c-34.8,17.1,-69.5,34.3,-104.5,51.1 c-13,6.3,-26,12.8,-39,19.1c-1.5,0.7,-3.7,1,-3.9,3.4c-3.7,0,-7.3,0,-11,0c-0.4,-3,-3.1,-2.3,-4.7,-2.7c-19.3,-4.8,-38.6,-9.5,-57.9,-14.1 c-27.5,-6.5,-55.2,-12.7,-82.6,-19.4c-30.9,-7.5,-61.8,-15,-92.7,-22.1c-24.8,-5.8,-49.5,-12,-74.3,-18C70.8,826.5,48.9,821.3,27,816 c-1.1,-0.3,-2.3,-0.5,-3.3,-1c-3.2,-1.3,-3.5,-3.3,-0.7,-5.4c0.9,-0.7,2,-1.2,3.1,-1.7c12,-5.3,24,-10.7,36,-16c0.4,-0.2,0.9,-0.2,1.9,-0.3 c0,3.6,0,7,0,10.5c0,1.6,-0.5,3.5,2,3.9c0.7,2.8,3.2,2.5,5.2,3c39.3,9,78.7,18.1,118.1,27c43.9,10,87.7,20,131.6,29.9 c9.7,2.2,19.2,4.9,29.1,6c1.1,1.5,2.6,0.9,4,1l0,0c4.1,2,8.5,2.6,13,3l0,0c7.2,2.4,14.4,4.3,22,5l0,0c6.5,2.5,13.3,3.6,20.1,4.9 c2.1,0.4,4.2,-0.1,6.3,-1.1c23.5,-11,46.9,-21.9,70.4,-32.8c29.2,-13.5,58.5,-26.9,87.8,-40.3c18.3,-8.4,36.6,-16.6,54.8,-25 c1.6,-0.7,3.1,-1.9,4.6,-2.8c2,-2.9,1.1,-6.2,0.9,-9.2c-0.3,-4.7,1.9,-5.5,5.7,-4.7c10.8,2.2,21.6,4.6,32.5,6.9C672,778.7,672,780.3,672,782z "
+ android:fillColor="#E6E4E4"/>
+ <path
+ android:pathData="M350,872c-9.9,-1.1,-19.4,-3.9,-29.1,-6C277,856,233.1,846,189.2,836c-39.4,-9,-78.7,-18,-118.1,-27 c-2,-0.4,-4.5,-0.2,-5.2,-3c0,-85.7,0,-171.4,0.1,-257.1c6.5,0.1,12.7,2.3,19,3.6c26.4,5.4,52.8,10.9,79.2,16.5c25.9,5.4,51.8,11,77.7,16.4 c26.2,5.5,52.5,11,78.7,16.5c30.1,6.3,60.2,12.6,90.3,19c0.3,68.9,0.7,137.8,1,206.7c0.1,17.1,0,34.3,0,51.4c0,5.9,0,6,-5.9,4.9 c-5.7,-1.1,-11.2,-3.2,-17.1,-2.9c0,0,0,0,0,0c-7,-3.1,-14.2,-5.4,-22,-5c0,0,0,0,0,0c-3.9,-2.9,-8.4,-2.9,-13,-3c0,0,0,0,0,0 C352.9,871.5,351.4,872.1,350,872z M177,687c0,3.2,0.1,6.3,0,9.5c-0.1,2.7,0.7,4,3.8,4.6c29.7,5.8,59.3,11.7,89,17.7 c2.4,0.5,4.7,0.1,4.9,-2.6c0.4,-3.7,1.2,-7.6,-0.6,-11.2c1,-3,1.2,-5.3,-3,-6c-29.6,-5.4,-59.2,-10.8,-88.7,-16.5C177.7,681.6,176.5,682.8,177,687 z"
+ android:fillColor="#E5E5E5"/>
+ <path
+ android:pathData="M411,621c-30.1,-6.3,-60.2,-12.6,-90.3,-19c-26.2,-5.5,-52.5,-11,-78.7,-16.5c-25.9,-5.5,-51.8,-11,-77.7,-16.4 c-26.4,-5.5,-52.8,-11.1,-79.2,-16.5c-6.3,-1.3,-12.5,-3.5,-19,-3.6c0,-23.6,0,-47.3,0,-70.9c12,-0.9,23.2,3.3,34.7,5.5c24.5,4.6,49,9.7,73.5,14.6 c1,0.2,1.9,0.6,2.8,1c0,3.3,0.7,6.7,0.7,9.9c0,5.6,2.4,7.5,7.5,8.4c15.3,2.7,30.5,5.8,45.8,8.7c12,2.3,24,4.4,36.1,6.6 c1.9,0.3,4.8,1.5,4.7,-1.4c-0.2,-4.6,1.7,-8.2,3.3,-12.1c10.2,0.9,20,3.8,30.1,5.5c11.7,2,23.1,5.3,34.9,6.5 c14.5,-3.2,28.1,-8.9,42.2,-13.2c8.1,-2.5,16.2,-5,24.1,-7.8c4.1,-1.5,4.8,-0.1,4.7,3.7C411,549.4,411,585.2,411,621z"
+ android:fillColor="#D9D9D9"/>
+ <path
+ android:pathData="M412,307c-6.9,3.5,-13.6,-0.2,-20.1,-1.3c-28.2,-5,-56.2,-10.4,-84.3,-15.8c-21.8,-4.1,-43.5,-8.5,-65.2,-12.6 c-27.3,-5.2,-54.6,-10.1,-81.9,-15.3c-22.1,-4.2,-44.1,-8.5,-66.2,-12.8c-7,-1.3,-13.9,-2.9,-21,-3.9c-4.1,-0.6,-5.2,-3,-5.3,-6.5c0,-1.2,0,-2.3,0,-3.5 c0,-51.1,0,-102.3,0,-153.4c0,-5,-0.3,-10,1,-14.9c24.1,4.3,48.1,8.6,72.2,12.8c24.9,4.4,49.8,8.7,74.6,13.1c31.9,5.6,63.7,11.3,95.6,16.9 c30.2,5.3,60.5,10.6,90.7,16c2.6,0.5,5.2,0.8,7.8,1.2c0,1.3,0.7,2,2,2C412,188.3,412,247.7,412,307z M409,217.4c0,-25.5,0,-51,0,-76.5 c0,-10.9,0.1,-11.2,-10.7,-13.2c-23.4,-4.4,-46.8,-8.5,-70.3,-12.6c-24.1,-4.3,-48.2,-8.4,-72.3,-12.6c-17.7,-3.1,-35.5,-6.3,-53.2,-9.4 c-22.1,-3.9,-44.3,-7.6,-66.4,-11.5c-20,-3.5,-40,-7.1,-60.1,-10.5c-6,-1,-6.1,-0.8,-6.1,5.6c0,53,0,105.9,0,158.9c0,1,0,2,0,3 c0.2,2.6,1,4.1,4,4.6c10.1,1.7,20.1,3.9,30.2,5.8c27.3,5.1,54.6,10.1,81.9,15.2c22.1,4.2,44.1,8.6,66.2,12.8 c27.3,5.2,54.6,10.2,81.9,15.3c22.7,4.3,45.5,8.6,68.2,12.8c6.5,1.2,6.5,1.1,6.5,-5.7C409,272,409,244.7,409,217.4z"
+ android:fillColor="#E8E8E8"/>
+ <path
+ android:pathData="M412,129c-1.3,0,-2,-0.7,-2,-2C411.3,127,412,127.7,412,129z"
+ android:fillColor="#EAEAEA"/>
+ <path
+ android:pathData="M65.8,248.3c10.1,0.7,19.8,3.5,29.7,5.2c19,3.3,38,7,57,10.6c15.9,3,31.8,6.2,47.8,9.2 c24,4.6,48,9.1,72,13.7c14.6,2.8,29.3,5.5,43.8,8.5c22.5,4.6,45.3,8.4,67.9,12.6c4.1,0.8,8.2,1.8,12.4,3.8 c-6.4,2.1,-12.8,4.3,-19.2,6.4c-9.5,3.1,-19.1,5.8,-28.4,9.4c-6.7,2.6,-13.3,2.5,-20,1.3c-41.4,-7.6,-82.8,-15.2,-124.2,-22.8 c-32.6,-6,-65.2,-11.9,-97.8,-17.8c-13.7,-2.5,-27.4,-4.9,-41.1,-7.4C65.9,270,65.9,259.1,65.8,248.3z"
+ android:fillColor="#E6A3A3"/>
+ <path
+ android:pathData="M275,519c-1.5,3.9,-3.5,7.5,-3.3,12.1c0.1,2.9,-2.8,1.7,-4.7,1.4c-12,-2.2,-24.1,-4.3,-36.1,-6.6 c-15.3,-2.9,-30.5,-6,-45.8,-8.7c-5.1,-0.9,-7.5,-2.8,-7.5,-8.4c0,-3.2,-0.8,-6.5,-0.7,-9.9c12.2,2.3,24.4,4.6,36.5,7c19.8,3.9,39.5,8,59.3,12 C273.6,518.2,274.3,518.7,275,519z"
+ android:fillColor="#CBCBCA"/>
+ <path
+ android:pathData="M202.9,345.9c0,3.3,-0.1,6.7,0.1,10c0.2,3.9,-1.4,4.3,-4.9,3.7c-29.9,-5.6,-59.8,-11.2,-89.8,-16.5 c-3,-0.5,-3.5,-1.7,-3.4,-4.2c0.1,-3.3,0.1,-6.7,0.1,-10c21.7,3.9,43.4,7.9,65.2,11.6C181.1,342.4,191.8,345.3,202.9,345.9z"
+ android:fillColor="#CFCFCE"/>
+ <path
+ android:pathData="M65.8,248.3c0,10.9,0,21.7,0,32.6c-17.9,-3.1,-35.8,-6.2,-53.7,-9.3c0,-0.4,0,-0.7,0,-1.1 C30.1,263,48,255.6,65.8,248.3z"
+ android:fillColor="#E57474"/>
+ <path
+ android:pathData="M202.9,345.9c-11.1,-0.6,-21.8,-3.5,-32.6,-5.4c-21.8,-3.7,-43.5,-7.7,-65.2,-11.6c-0.6,-3.8,0.6,-5.6,4.8,-4.8 c28.3,5,56.6,9.9,84.9,14.9c1.1,0.2,2.3,0.8,3.4,0.8C202.8,339.6,203.4,342.3,202.9,345.9z"
+ android:fillColor="#BDBDBD"/>
+ <path
+ android:pathData="M367,876c7.8,-0.4,15,1.9,22,5C381.4,880.3,374.2,878.4,367,876z"
+ android:fillColor="#EFEFEE"/>
+ <path
+ android:pathData="M354,873c4.5,0.1,9.1,0.1,13,3C362.5,875.6,358.1,875,354,873z"
+ android:fillColor="#EFEFEE"/>
+ <path
+ android:pathData="M350,872c1.4,0.1,3,-0.5,4,1C352.6,872.9,351,873.5,350,872z"
+ android:fillColor="#EFEFEE"/>
+ <path
+ android:pathData="M274.1,705c1.9,3.6,1,7.5,0.6,11.2c-0.3,2.8,-2.5,3.1,-4.9,2.6c-29.7,-5.9,-59.3,-11.9,-89,-17.7 c-3.1,-0.6,-3.9,-1.9,-3.8,-4.6c0.1,-3.2,0,-6.3,0,-9.5c1.2,0,2.4,-0.1,3.5,0.1c19.2,3.8,38.4,7.7,57.6,11.4 C250.1,700.8,261.9,703.8,274.1,705z"
+ android:fillColor="#D6D6D5"/>
+ <path
+ android:pathData="M274.1,705c-12.1,-1.2,-24,-4.2,-35.9,-6.5c-19.2,-3.7,-38.4,-7.6,-57.6,-11.4c-1.1,-0.2,-2.3,-0.1,-3.5,-0.1 c-0.5,-4.2,0.7,-5.4,5.3,-4.5c29.5,5.7,59.1,11.1,88.7,16.5C275.3,699.7,275.1,702,274.1,705z"
+ android:fillColor="#C9C9C8"/>
+ <path
+ android:pathData="M409,217.4c0,27.3,0,54.6,0,82c0,6.8,0,6.9,-6.5,5.7c-22.7,-4.2,-45.5,-8.6,-68.2,-12.8 c-27.3,-5.1,-54.6,-10.1,-81.9,-15.3c-22.1,-4.2,-44.1,-8.6,-66.2,-12.8c-27.3,-5.2,-54.6,-10.1,-81.9,-15.2c-10.1,-1.9,-20.1,-4.1,-30.2,-5.8 c-3,-0.5,-3.9,-2.1,-4,-4.6c-0.1,-1,0,-2,0,-3c0,-53,0,-105.9,0,-158.9c0,-6.4,0,-6.6,6.1,-5.6c20,3.4,40,7,60.1,10.5c22.1,3.9,44.3,7.6,66.4,11.5 c17.7,3.1,35.5,6.3,53.2,9.4c24.1,4.2,48.2,8.4,72.3,12.6c23.4,4.1,46.9,8.2,70.3,12.6c10.8,2,10.7,2.3,10.7,13.2 C409,166.4,409,191.9,409,217.4z M283.9,146.9c0.4,-3.2,-0.2,-5.3,-4,-6c-29.7,-5,-59.4,-9.9,-89,-15.3c-4.8,-0.9,-5.2,0.7,-4.8,4.4 c0,3.5,-0.1,7,0,10.5c0,1.3,-0.4,3.2,1.4,3.3c2.9,0.1,5.3,1.8,8.1,2.3c13.8,2.4,27.6,4.9,41.4,7.4c13.3,2.4,26.5,5.1,39.8,7.4 c6.6,1.2,7.3,0.4,7.3,-6.5C284,151.9,283.9,149.4,283.9,146.9z"
+ android:fillColor="#E8E7E7"/>
+ <path
+ android:pathData="M283.9,146.9c0,2.5,0.1,5,0.1,7.5c0,6.9,-0.7,7.7,-7.3,6.5c-13.3,-2.4,-26.5,-5,-39.8,-7.4 c-13.8,-2.5,-27.6,-5.1,-41.4,-7.4c-2.8,-0.5,-5.2,-2.2,-8.1,-2.3c-1.8,-0.1,-1.4,-2,-1.4,-3.3c0,-3.5,0,-7,0,-10.5c1.9,0.3,3.9,0.7,5.8,1 c21.6,4,43.1,8.1,64.7,11.8C265.6,144.4,274.5,147.1,283.9,146.9z"
+ android:fillColor="#CFCFCE"/>
+ <path
+ android:pathData="M283.9,146.9c-9.3,0.2,-18.3,-2.5,-27.3,-4.1c-21.6,-3.7,-43.1,-7.8,-64.7,-11.8c-1.9,-0.4,-3.9,-0.7,-5.8,-1 c-0.4,-3.6,-0.1,-5.2,4.8,-4.4c29.6,5.4,59.3,10.4,89,15.3C283.7,141.6,284.3,143.7,283.9,146.9z"
+ android:fillColor="#BDBDBD"/>
+</vector>
diff --git a/packages/DocumentsUI/res/drawable/hourglass.xml b/packages/DocumentsUI/res/drawable/hourglass.xml
new file mode 100644
index 0000000..9b8d0e2
--- /dev/null
+++ b/packages/DocumentsUI/res/drawable/hourglass.xml
@@ -0,0 +1,168 @@
+<!--
+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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="421dp"
+ android:height="909dp"
+ android:viewportWidth="421.0"
+ android:viewportHeight="909.0">
+ <path
+ android:pathData="M36,122.9c-2.8,-2.6,-5.7,-5.1,-8.3,-7.8c-5.6,-6,-9.2,-12.9,-8.8,-21.5c0.3,-7.5,0.6,-15,-0.1,-22.5 c-1.2,-14.1,5.5,-23.9,16,-31.9c16.7,-12.8,36.1,-19.6,56.1,-25.1c23.8,-6.5,48,-10.2,72.5,-12.3C168.6,1.3,174,2.2,179,0 c19.3,0,38.7,0,58,0c6,2.1,12.4,1.3,18.6,1.8c30.2,2.7,59.9,7.6,88.5,17.5c16.5,5.7,32.6,12.6,45.2,25.4c6.5,6.6,10.3,14,9.8,23.6 c-0.4,7.8,-0.5,15.7,0,23.4c0.6,10.3,-3.4,18.4,-10.6,25.2c-2.2,2,-4.4,4,-6.6,6c-3,2,-6.1,4,-9.1,5.9c-9.2,4.5,-18.5,9,-28.2,12.3 c-42.4,14.5,-86.3,18.8,-130.8,19.6c-10.9,0.2,-21.9,-0.4,-32.9,-0.7c-4.6,-0.4,-9.2,-0.8,-13.9,-1.1c-18.9,-1.1,-37.5,-3.9,-56,-7.6 c-15.3,-3.1,-30.2,-7.6,-44.9,-12.6c-7.6,-3.7,-15.3,-7.4,-22.9,-11.1C41.1,125.8,38.6,124.3,36,122.9z M41,72c2.9,6.9,7.1,12.6,13.1,17.2 c13,10,27.9,15.8,43.4,20.6c28.2,8.8,57.2,12.8,86.5,14c31.8,1.2,63.7,0.8,95.3,-4.6c25.3,-4.4,50.1,-10,72.9,-22.2 c10.8,-5.8,20,-13.1,24.7,-24.9c2.3,-11,-2.3,-19.5,-10.2,-26.4c-10.5,-9.2,-23.1,-14.9,-36.2,-19.6C295.2,13.4,258.4,9.7,221.2,8.1 c-11.1,-0.5,-22.2,0,-33.4,0.6c-21.4,1,-42.6,3.1,-63.6,7.3c-22.2,4.5,-44.1,10.3,-63.4,22.6C48.9,46.3,38.4,55.4,41,72z"
+ android:fillColor="#9F9F9F"/>
+ <path
+ android:pathData="M0,829c3.7,-2.8,4.7,-7.6,7.8,-10.9c2.6,-2.8,4.9,-5.7,9.2,-7.6c0,3.4,-0.1,6.5,0,9.5c0,1.5,-0.7,3.5,1.7,4 c0.4,3.3,1.4,6.4,2.9,9.4c3.8,7.7,10,13,16.8,17.9c9.2,6.7,19.7,10.8,29.8,15.5c-0.7,2.4,1.3,0.7,1.8,1.1l0,0c1.5,2.1,3.7,2.2,6,2 l0,0c0.8,0.6,1.5,1.4,2.4,1.7c9.5,2.7,18.9,5.8,28.7,7.4c3.6,0.6,7,3.5,10.9,1.1c2.4,0.4,4.8,0.8,7.1,1.2c0.2,1.5,1.3,1.6,2.5,1.8 c6.6,0.9,13.3,2.4,19.9,2.8c5.1,0.3,10.3,2.9,15.4,0.3c0.4,0,0.8,0.1,1.1,0.1c0.3,2.2,2.1,1.8,3.5,1.8c3.8,0,7.6,0,11.5,0 c1.1,1.4,2.7,1,4.1,1c17.2,0,34.5,0,51.7,0c1.4,0,3,0.4,4.1,-1c3.8,0,7.6,0,11.5,0c1.4,0,3.2,0.4,3.5,-1.8c9.4,-1,18.7,-2.1,28.1,-3.1 c6,1.3,11.6,0.4,16.9,-2.8c21.2,-4.2,42.1,-9.3,61.8,-18.4c15.8,-7.3,30.8,-15.8,38,-33.1c2.4,-2,1.9,-4.8,2.2,-7.4c0.3,-3,0,-6,0.1,-9 c0,-1,-0.3,-2.1,0.7,-2.7c1.1,-0.7,1.7,0.5,2.5,1c7.2,5,12.1,11.7,14.8,20c0.4,1.2,0.6,2.2,2.1,2.3c0,3.3,0,6.7,0,10 c-1.5,0,-1.8,1.1,-2.2,2.2c-3.8,10.2,-11.2,17.5,-20.1,23.3c-20.8,13.6,-44.1,21.2,-68.1,26.7c-29.2,6.7,-58.7,11,-88.7,11.7 c-1.6,0,-3.5,-0.5,-3.9,2c-18.7,0,-37.3,0,-56,0c-0.3,-2.5,-2.3,-1.9,-3.9,-2c-5.6,-0.1,-11.2,-0.5,-16.9,-0.8c-18.5,-1.2,-36.8,-3.8,-55,-7.3 C79.9,893.9,54,887,30.2,874C19,867.9,8.5,860.9,2.5,849C2,848,1.4,847,0,847C0,841,0,835,0,829z"
+ android:fillColor="#E6E4E4"/>
+ <path
+ android:pathData="M372.9,128.9c3,-2,6.1,-4,9.1,-5.9c-0.2,2.7,0.2,5.4,1,8c-1.5,1.6,-0.3,1.8,1,2c0.3,1,0.7,2,1,3 c-1.5,1.6,-0.3,1.8,1,2c0.7,2,1.3,4,2,6c-1.5,1.6,-0.3,1.8,1,2c0.3,1.7,0.7,3.3,1,5c-1,2.3,-0.6,4.1,2,5c4.9,23.8,9,47.6,8,72 c-3.5,1.5,-2.1,3.8,-1,6c-1,6,-2,12,-3,18c-1.3,1,-1.3,2,0,3c0,0.7,0,1.3,0,2c-2.1,0.4,-2.6,1.3,-1,3c0,0.3,0,0.7,0,1 c-1.3,0.2,-2.5,0.4,-1,2c0.4,2.1,-0.7,4,-1,6c-1.3,0.2,-2.5,0.4,-1,2c-3.7,9.3,-7.3,18.7,-11,28c-2.7,1.2,-4.2,2.9,-3,6 c-3.4,6.9,-7.8,13.3,-12.2,19.5c-6.1,8.6,-12.4,17.3,-19.4,25.2c-7.3,8.3,-15.5,15.8,-23.9,23c-11.9,10.3,-24.9,19.3,-38.1,27.7 c-12.2,7.8,-25.4,14.1,-38.4,20.5c-12.1,6,-18.5,15.8,-21,28.6c-1.5,7.8,-0.5,15.4,2,22.8c1.2,3.5,3.7,6.1,5.6,9.2 c5.4,8.6,14.8,10.5,22.6,15c15.3,9,30.8,17.7,45.3,28.1c14.4,10.4,28.2,21.5,40.5,34.1c10.1,10.4,18.5,22.2,26.8,34.3 c6.5,9.5,11.3,19.6,16.1,29.8c-1.5,1.6,-0.3,1.8,1,2c0.7,2,1.3,4,2,6c-1,2.3,-0.6,4.1,2,5c0.7,1.2,1.2,2.5,1,4c-1,2.3,-0.6,4.1,2,5 c1.2,12.3,4.6,24.1,5.7,36.5c0.8,8.4,1.4,16.8,1,25.1c-0.3,5.9,-1.1,12,-1.9,18c-1.2,8.7,-2.3,17.4,-4.2,25.9 c-1.5,6.6,-3.7,13.1,-5.6,19.6c-1.8,3.1,-2.9,6.5,-3.9,9.9c-3.4,6.4,-5.6,13.6,-11.9,18.2c-0.1,-3.8,1.6,-7.1,3,-10.4 c8.7,-20.9,13,-42.8,14.7,-65.1c1,-12.9,0.2,-25.8,-1.7,-38.7c-2.7,-18.5,-7.8,-36.2,-15.8,-53.1c-7.3,-15.4,-16.8,-29.3,-27.7,-42.4 c-2.7,-3.2,-6.3,-5.7,-9.6,-8.6c0.4,0.8,0.7,1.4,1,1.9c0.7,1.1,1.5,2.2,2.3,3.3c16.5,21.5,28.5,45.2,34.2,71.7c0.7,3.3,3.1,6.9,0.3,10.4 c-1,-1.9,-2.1,-3.7,-3.1,-5.6c-3.3,-6.3,-6.1,-12.9,-11.7,-17.6c-0.4,-0.9,-0.8,-1.8,-1.3,-2.6c-4,-6.3,-10.4,-10.4,-14.8,-16.2c0,-5.4,-2.7,-9.9,-4.8,-14.5 c-8.4,-18.6,-20.4,-34.9,-32.9,-50.8c-8.4,-10.8,-15.5,-22.8,-28.7,-28.8c-5.3,-2.4,-10,-6,-15.1,-8.6c-5.1,-2.6,-9.9,-6.4,-16.3,-5.2 c-5.2,1,-10.4,2.1,-15.3,4.1c-29.3,11.9,-48.4,34.1,-61.8,61.9c-0.3,0.3,-0.7,0.6,-1,1c-7.1,0.8,-13.9,2.9,-20.7,5.1 c-32.6,10.6,-61,27.4,-82.3,54.9c-9.2,11.6,-15.4,24.7,-18.9,39c-1.5,-1.1,-1.1,-2.7,-1.1,-4.1c-0.1,-9.6,0.3,-19.2,1.8,-28.7 c3.7,-22.6,11.8,-43.5,24,-62.8c12.6,-20,28.6,-36.9,47,-51.7c21.3,-17.3,44.6,-31.3,69.3,-42.9c14.5,-6.8,20,-18.8,21.8,-33.1 c1.8,-13.3,-4.9,-24.1,-12.2,-34.4c-3.6,-5,-7.4,-9.8,-13.2,-12.5c-5.8,-2.8,-11.6,-5.7,-17.4,-8.7c-22,-11.6,-42.6,-25.1,-61.1,-41.7 c-20.7,-18.6,-37.9,-40,-48.8,-65.9c-6.7,-15.7,-10.9,-32.1,-12,-49c-1.8,-27.1,2.1,-53.6,11.7,-79.1c3.8,-10.1,7.1,-20.4,13.3,-29.4 c14.7,5,29.6,9.5,44.9,12.6c18.5,3.7,37.2,6.5,56,7.6c4.6,0.3,9.3,0.7,13.9,1.1c0.2,3.6,-1.5,6.8,-2.6,10 c-11.9,33.6,-17.8,68.2,-17.2,103.8c0.2,9.7,1.3,19.4,2.7,29.1c3.8,24.6,11.4,47.7,26,68.1c12.2,17.1,28.4,28.6,49,33.4 c4.7,1.1,9.5,2.2,14.5,-0.5c18.7,-10.2,36.8,-21.2,53.7,-34.2c15.4,-11.9,29.4,-25.3,41.5,-40.5c12.9,-16.2,23.4,-33.8,30.4,-53.4 c6.4,-17.6,10.3,-35.6,10.9,-54.3c0.5,-15.9,0.2,-31.9,-3,-47.6C383.8,158.7,380.1,143.3,372.9,128.9z"
+ android:fillColor="#EDECEC"/>
+ <path
+ android:pathData="M383,780c1.1,-3.4,2.1,-6.8,3.9,-9.9c7.8,7.1,12.8,15.2,12.2,26.4c-0.6,10.7,-0.3,21.5,-0.5,32.3 c-7.2,17.3,-22.2,25.8,-38,33.1c-19.7,9.1,-40.6,14.1,-61.8,18.4c-5.6,0.9,-11.3,1.9,-16.9,2.8c-9.4,1,-18.7,2.1,-28.1,3.1 c-5,0.3,-9.9,0.7,-14.9,1c-20,1.2,-40,0.9,-60,0c-5,-0.3,-9.9,-0.7,-14.9,-1c-0.4,0,-0.8,-0.1,-1.1,-0.1c-12.6,-1.6,-25.2,-3.2,-37.9,-4.8 c-2.4,-0.4,-4.8,-0.8,-7.1,-1.2c-2.6,-0.6,-5.1,-1.3,-7.7,-1.8c-11.6,-2,-22.6,-6.3,-34.2,-8.4c0,0,0,0,0,0c-1.7,-1.6,-3.7,-2.2,-6,-2c0,0,0,0,0,0 c-0.2,-1,-1.1,-0.9,-1.8,-1.1c-10.2,-4.7,-20.6,-8.8,-29.8,-15.5c-6.8,-4.9,-13,-10.2,-16.8,-17.9c-1.5,-3,-2.4,-6.1,-2.9,-9.4 c0.1,-10.3,0,-20.6,0.2,-30.9c0.1,-8.3,3.5,-15,10,-20.2c2,3.5,3.4,7.1,4.1,11c-1.1,0.8,-1,2,-1.1,3.1c-0.6,8.2,2.9,14.9,8.3,20.6 c8.9,9.6,20.4,15.4,32.3,20.2c17.9,7.2,36.5,11.9,55.4,15.4c20.1,3.7,40.3,5.7,60.6,6.5c21.4,0.8,42.8,0.4,64.2,-1.6 c19.8,-1.9,39.4,-4.6,58.7,-9.3c19.9,-4.8,39.3,-11.2,56.4,-22.9c7.8,-5.3,15.2,-11.3,17.4,-21C386.4,790.1,388.3,784.3,383,780z"
+ android:fillColor="#9F9F9F"/>
+ <path
+ android:pathData="M378,305c-1.2,-3.1,0.3,-4.8,3,-6C380.6,301.3,379.7,303.3,378,305z"
+ android:fillColor="#F1F0F0"/>
+ <path
+ android:pathData="M399,234c-1.1,-2.2,-2.5,-4.5,1,-6C399.7,230,400.8,232.2,399,234z"
+ android:fillColor="#F1F0F0"/>
+ <path
+ android:pathData="M392,156c-2.6,-0.9,-3,-2.7,-2,-5C391.4,152.4,391.6,154.2,392,156z"
+ android:fillColor="#F1F0F0"/>
+ <path
+ android:pathData="M389,636c-2.6,-0.9,-3,-2.7,-2,-5C388.4,632.4,388.6,634.2,389,636z"
+ android:fillColor="#F1F0F0"/>
+ <path
+ android:pathData="M392,645c-2.6,-0.9,-3,-2.7,-2,-5C391.4,641.4,391.6,643.2,392,645z"
+ android:fillColor="#F1F0F0"/>
+ <path
+ android:pathData="M396,255c-1.3,-1,-1.3,-2,0,-3C397.3,253,397.3,254,396,255z"
+ android:fillColor="#F1F0F0"/>
+ <path
+ android:pathData="M395,260c-1.6,-1.7,-1.1,-2.6,1,-3C395.7,258,395.3,259,395,260z"
+ android:fillColor="#F1F0F0"/>
+ <path
+ android:pathData="M384,133c-1.3,-0.2,-2.5,-0.4,-1,-2C383.8,131.4,384,132.2,384,133z"
+ android:fillColor="#F1F0F0"/>
+ <path
+ android:pathData="M385,625c-1.3,-0.2,-2.5,-0.4,-1,-2C384.8,623.4,385,624.2,385,625z"
+ android:fillColor="#F1F0F0"/>
+ <path
+ android:pathData="M392,271c-1.5,-1.6,-0.3,-1.8,1,-2C393,269.8,392.8,270.6,392,271z"
+ android:fillColor="#F1F0F0"/>
+ <path
+ android:pathData="M394,263c-1.5,-1.6,-0.3,-1.8,1,-2C395,261.8,394.8,262.6,394,263z"
+ android:fillColor="#F1F0F0"/>
+ <path
+ android:pathData="M386,138c-1.3,-0.2,-2.5,-0.4,-1,-2C385.8,136.4,386,137.2,386,138z"
+ android:fillColor="#F1F0F0"/>
+ <path
+ android:pathData="M389,146c-1.3,-0.2,-2.5,-0.4,-1,-2C388.8,144.4,389,145.2,389,146z"
+ android:fillColor="#F1F0F0"/>
+ <path
+ android:pathData="M33.1,783.9c-0.8,-3.9,-2.2,-7.6,-4.1,-11c-3.7,-11.7,-7.2,-23.5,-9.2,-35.5c-1.3,-7.6,-1.9,-15.4,-2.7,-23.2 c-0.6,-6.2,-0.9,-12.4,-1,-18.5c-0.2,-7.9,1.9,-15.7,2.3,-23.4c0.5,-10.1,2.9,-19.5,5.5,-29c6.3,-23.1,17.3,-43.9,31.5,-62.8 c23.4,-31.1,53.3,-54.7,86.9,-74.1c10.1,-5.8,20.3,-11.6,30.9,-16.2c11.7,-5.2,16.3,-14.9,18.8,-26.3c3.2,-14.9,-2.8,-26.6,-12.7,-37.1 c-1.8,-1.9,-3.9,-3.1,-6.2,-4.2c-23.7,-11.4,-46.4,-24.4,-67.2,-40.7c-16.2,-12.6,-31.3,-26.5,-44.2,-42.6c-16.2,-20.3,-28.8,-42.5,-36.2,-67.5 c-3.1,-10.6,-5.4,-21.3,-6.2,-32.4c-0.7,-9.6,-3.2,-19.3,-2,-28.8c0.8,-6.6,1.5,-13.4,1.9,-20c1,-15.2,4.9,-29.6,9.2,-44c1.7,-5.7,4,-11.3,6.4,-16.8 c0.9,-2.2,1.3,-4.4,1.3,-6.8c2.6,1.4,5.1,2.9,7.2,4.9c-0.6,0.8,-1.4,1.4,-1.8,2.3c-11.2,26.2,-16.2,53.8,-17.4,82.2 c-0.4,8.8,1,17.5,1.9,26.2c2,19.7,7.4,38.4,15.6,56.3c17.9,39.2,46.6,69.1,81.3,93.6c18.5,13.1,38.1,24.3,58.5,34.1 c3.3,1.6,6,3.7,8.1,6.5c8,10.6,12.6,22.1,9.6,35.7c-2.1,9.4,-6.5,17.9,-14.8,22.7c-8.2,4.7,-16.9,8.5,-25.3,12.9 c-22.5,12,-43.8,25.8,-62.6,43c-21.9,19.9,-40.8,42.1,-53.7,69.2C26.3,646.5,20.6,682,24.1,719c1.8,18.7,7,36.7,12.7,54.6 c5.9,18.7,18.2,30.9,35.3,38.9c15.4,7.2,31.5,12.2,48.1,15.8c1.6,0.4,4.3,-0.3,4.8,2.6c-18,-2.8,-35.4,-7.5,-52.3,-14.5 c-12.2,-5.1,-23.4,-11.4,-32.4,-21.4C37.2,791.7,36.5,787,33.1,783.9z"
+ android:fillColor="#EDECEC"/>
+ <path
+ android:pathData="M372.9,128.9c7.2,14.3,10.9,29.8,14.1,45.4c3.2,15.7,3.5,31.6,3,47.6c-0.6,18.7,-4.6,36.7,-10.9,54.3 c-7.1,19.6,-17.6,37.2,-30.4,53.4c-12.1,15.2,-26.1,28.6,-41.5,40.5c-16.9,13,-35,24,-53.7,34.2c-5,2.7,-9.8,1.6,-14.5,0.5 c-20.6,-4.8,-36.8,-16.3,-49,-33.4c-14.6,-20.4,-22.3,-43.5,-26,-68.1c-1.5,-9.7,-2.6,-19.4,-2.7,-29.1c-0.6,-35.6,5.4,-70.2,17.2,-103.8 c1.2,-3.3,2.8,-6.4,2.6,-10c11,0.2,21.9,0.9,32.9,0.7c44.4,-0.8,88.4,-5.2,130.8,-19.6C354.4,137.9,363.7,133.5,372.9,128.9z"
+ android:fillColor="#F1F0F0"/>
+ <path
+ android:pathData="M377,72c-4.6,11.9,-13.9,19.1,-24.7,24.9c-22.9,12.2,-47.6,17.9,-72.9,22.2c-31.6,5.4,-63.5,5.9,-95.3,4.6 c-29.3,-1.1,-58.3,-5.1,-86.5,-14C82.1,105,67.2,99.1,54.2,89.2C48.2,84.6,43.9,78.8,41,72c3.9,-1.8,4.6,-6.2,7.3,-9 c10.3,-10.5,22.9,-16.9,36.5,-21.8c19.7,-7.1,40,-11.5,60.7,-14.5c19.4,-2.8,38.9,-3.9,58.4,-4.5c17.9,-0.6,35.8,0.8,53.6,2.8 c15,1.6,29.9,3.5,44.5,7.1c20,4.9,39.7,10.7,57.2,22.1C366.5,58.8,371.5,65.5,377,72z"
+ android:fillColor="#8D8E8E"/>
+ <path
+ android:pathData="M125,831c-0.4,-2.9,-3.2,-2.3,-4.8,-2.6c-16.6,-3.7,-32.7,-8.7,-48.1,-15.8c-17.1,-8,-29.4,-20.2,-35.3,-38.9 c-5.7,-17.9,-10.9,-35.9,-12.7,-54.6c-3.6,-37.1,2.1,-72.5,18.4,-106.4c13,-27.1,31.9,-49.3,53.7,-69.2c18.8,-17.1,40.2,-30.9,62.6,-43 c8.4,-4.5,17.1,-8.2,25.3,-12.9c8.4,-4.8,12.7,-13.3,14.8,-22.7c3.1,-13.6,-1.6,-25.1,-9.6,-35.7c-2.1,-2.8,-4.8,-4.9,-8.1,-6.5 c-20.4,-9.9,-40,-21.1,-58.5,-34.1c-34.7,-24.6,-63.4,-54.5,-81.3,-93.6c-8.2,-17.9,-13.6,-36.6,-15.6,-56.3c-0.9,-8.7,-2.3,-17.5,-1.9,-26.2 c1.2,-28.3,6.2,-55.9,17.4,-82.2c0.4,-0.9,1.2,-1.5,1.8,-2.3c7.6,3.7,15.3,7.4,22.9,11.1c-6.2,9,-9.5,19.3,-13.3,29.4 c-9.6,25.5,-13.5,52,-11.7,79.1c1.1,16.9,5.4,33.3,12,49c11,25.9,28.1,47.4,48.8,65.9c18.5,16.6,39.1,30.2,61.1,41.7 c5.7,3,11.5,5.9,17.4,8.7c5.8,2.8,9.7,7.6,13.2,12.5c7.3,10.3,14,21.1,12.2,34.4c-1.9,14.3,-7.4,26.3,-21.8,33.1 c-24.7,11.6,-48,25.7,-69.3,42.9c-18.3,14.9,-34.3,31.7,-47,51.7c-12.2,19.3,-20.3,40.2,-24,62.8c-1.6,9.6,-2,19.1,-1.8,28.7 c0,1.4,-0.4,3.1,1.1,4.1c-0.6,14.9,0.1,29.8,3,44.5c4.2,21.4,9.1,42.6,26,58.4c-0.2,2.3,0.9,4.1,2.2,5.9c8.8,12.3,22,18.6,35.3,24.1 c26.4,10.9,54.2,16.1,82.4,19.1c1.7,0.2,3,0.4,3,2.4c-4.5,0.7,-9,0.9,-13.4,0.5c-13.2,-1,-26.5,-1.9,-39.6,-4.1c-0.6,-2.4,-1.7,-2.3,-3.1,-0.6 c-1.3,-0.1,-2.6,-0.3,-3.9,-0.4c-0.6,-2.3,-1.6,-2.4,-3.1,-0.7c-0.6,-0.1,-1.3,-0.2,-1.9,-0.3c-0.6,-2.4,-1.7,-2.4,-3.1,-0.6 C126.2,831.2,125.6,831.1,125,831z"
+ android:fillColor="#E8E8E7"/>
+ <path
+ android:pathData="M377,72c-5.4,-6.4,-10.5,-13.2,-17.7,-17.9C341.7,42.7,322.1,36.9,302,32c-14.6,-3.6,-29.5,-5.5,-44.5,-7.1 c-17.8,-1.9,-35.7,-3.3,-53.6,-2.8c-19.5,0.6,-39,1.7,-58.4,4.5c-20.7,3,-41,7.4,-60.7,14.5C71.3,46.1,58.7,52.4,48.4,63 c-2.7,2.8,-3.5,7.2,-7.3,9c-2.6,-16.6,7.9,-25.6,19.8,-33.3c19.3,-12.3,41.2,-18.2,63.4,-22.6c21,-4.2,42.2,-6.3,63.6,-7.3 c11.1,-0.5,22.3,-1,33.4,-0.6c37.2,1.5,74,5.3,109.4,17.9c13.1,4.6,25.6,10.4,36.2,19.6C374.7,52.5,379.3,61,377,72z"
+ android:fillColor="#808080"/>
+ <path
+ android:pathData="M179,887.2c20,0.9,40,1.2,60,0c0,0.3,0,0.5,0,0.8c-1.1,1.4,-2.7,1,-4.1,1c-17.2,0,-34.5,0,-51.7,0 c-1.4,0,-3,0.4,-4.1,-1C179,887.7,179,887.5,179,887.2z"
+ android:fillColor="#F4F3F2"/>
+ <path
+ android:pathData="M76,869.9c11.6,2.2,22.6,6.5,34.2,8.4c2.6,0.4,5.2,1.2,7.7,1.8c-3.9,2.3,-7.3,-0.6,-10.9,-1.1 c-9.8,-1.6,-19.2,-4.7,-28.7,-7.4C77.5,871.3,76.8,870.5,76,869.9z"
+ android:fillColor="#F4F3F2"/>
+ <path
+ android:pathData="M125.1,881.3c12.6,1.6,25.2,3.2,37.9,4.8c-5.2,2.6,-10.3,0,-15.4,-0.3c-6.7,-0.4,-13.3,-1.9,-19.9,-2.8 C126.3,882.9,125.2,882.8,125.1,881.3z"
+ android:fillColor="#F4F3F2"/>
+ <path
+ android:pathData="M282,883.1c5.6,-0.9,11.3,-1.9,16.9,-2.8C293.7,883.4,288.1,884.4,282,883.1z"
+ android:fillColor="#F4F3F2"/>
+ <path
+ android:pathData="M179,887.2c0,0.3,0,0.5,0,0.8c-3.8,0,-7.6,0,-11.5,0c-1.4,0,-3.2,0.4,-3.5,-1.8C169,886.5,174,886.9,179,887.2z"
+ android:fillColor="#FFFFFF"/>
+ <path
+ android:pathData="M239,888c0,-0.3,0,-0.5,0,-0.8c5,-0.3,9.9,-0.7,14.9,-1c-0.3,2.2,-2.1,1.8,-3.5,1.8C246.6,888,242.8,888,239,888z"
+ android:fillColor="#FFFFFF"/>
+ <path
+ android:pathData="M70,867.9c2.3,-0.2,4.3,0.4,6,2C73.8,870.1,71.6,870,70,867.9z"
+ android:fillColor="#F4F3F2"/>
+ <path
+ android:pathData="M68.2,866.8c0.7,0.2,1.6,0.2,1.8,1.1C69.5,867.4,67.6,869.2,68.2,866.8z"
+ android:fillColor="#F4F3F2"/>
+ <path
+ android:pathData="M165,584c0.3,-0.3,0.7,-0.6,1,-1c10.5,-1.3,21,-3.3,31.5,-3.8c20.8,-1.1,41.4,0.7,61.7,5.4 c30.5,7,57.8,20.3,81.8,40.5c4.4,5.9,10.8,10,14.8,16.2c0.5,0.8,0.9,1.7,1.3,2.6c-2.4,4.1,-4.7,8.1,-7.1,12.2c-4,3.7,-6.3,8.9,-11,12 c-1.6,-0.1,-2.8,0.5,-4.1,1.5c-12.6,9.3,-26.7,15.6,-41.5,20.1c-31,9.4,-62.6,13.3,-95.1,11.6c-12.3,-0.6,-24.5,-1.5,-36.5,-3.4 c-4.5,-0.7,-5.3,0.5,-4.8,4.2c-0.5,0,-1,0.1,-1.5,0c-17.8,-3.9,-34.7,-10.3,-50.9,-18.7c-1,-0.5,-1.6,-1.1,-1.6,-2.3c2.3,-0.3,4.1,1.1,6.1,2 c14.2,6.2,28.9,10.6,44.1,13.3c2.5,0.4,3,0.2,2.4,-2.3c-2.5,-9.3,-3.7,-18.7,-4.8,-28.3c-1.5,-13.7,-0.3,-27.1,1.7,-40.5 C154.6,610.8,159.7,597.4,165,584z"
+ android:fillColor="#E57474"/>
+ <path
+ android:pathData="M103,681c0.1,1.1,0.7,1.8,1.6,2.3c16.2,8.4,33.1,14.8,50.9,18.7c0.5,0.1,1,0,1.5,0c0.6,0.4,1.3,0.7,1.9,1.1 c-0.1,2.7,1,5.2,1.9,7.6c6.5,17.8,16.5,33.6,27.5,48.8c12.5,17.1,27.1,32.1,45.1,43.6c6.6,4.2,13.7,7.3,20.5,11 c-15.6,2.8,-31.4,2.5,-47.1,2.4c-9.9,0,-19.9,-0.2,-29.8,-1.1c-18.2,-1.6,-36.2,-3.9,-54,-8.3c-18.1,-4.4,-35.9,-9.5,-51,-21.1 c-16.9,-15.8,-21.8,-37,-26,-58.4c-2.9,-14.7,-3.6,-29.6,-3,-44.5c3.5,-14.4,9.7,-27.4,18.9,-39c3.4,4.8,6.2,10.1,10.3,14.2 c6,6.1,11.6,13,19.7,16.8c0.5,0.8,1.2,1,2.1,1c0,0,0,0,0,0c0.3,0.3,0.7,0.7,1,1c0,0,0,0,0,0c0.3,0.3,0.7,0.7,1,1l0,0 c1,1.3,2.4,1.8,4,2l0,0C100.7,681.2,101.9,681,103,681L103,681z"
+ android:fillColor="#E6A3A3"/>
+ <path
+ android:pathData="M341,625c-24,-20.1,-51.3,-33.5,-81.8,-40.5c-20.3,-4.7,-41,-6.5,-61.7,-5.4c-10.5,0.6,-21,2.5,-31.5,3.8 c13.4,-27.8,32.5,-49.9,61.8,-61.9c4.9,-2,10.1,-3.1,15.3,-4.1c6.3,-1.2,11.2,2.6,16.3,5.2c5.2,2.6,9.9,6.2,15.1,8.6 c13.3,6,20.3,18,28.7,28.8c12.5,16,24.6,32.2,32.9,50.8C338.3,615.2,341,619.7,341,625z"
+ android:fillColor="#F1F0F0"/>
+ <path
+ android:pathData="M91.9,675c-8,-3.8,-13.6,-10.7,-19.7,-16.8c-4.1,-4.1,-6.9,-9.4,-10.3,-14.2c21.3,-27.5,49.8,-44.3,82.3,-54.9 c6.8,-2.2,13.6,-4.3,20.7,-5.1c-5.3,13.4,-10.4,26.9,-12.5,41.2c-2,13.4,-3.2,26.8,-1.7,40.5c1.1,9.6,2.3,19,4.8,28.3 c0.7,2.5,0.1,2.7,-2.4,2.3c-15.2,-2.6,-29.9,-7.1,-44.1,-13.3c-2,-0.9,-3.7,-2.3,-6.1,-2c0,0,0,0,0,0c-0.7,-1.2,-1.9,-1,-3,-1c0,0,0,0,0,0 c-0.3,-2.7,-2.4,-1.8,-4,-2c0,0,0,0,0,0c-0.3,-0.3,-0.7,-0.7,-1,-1c0,0,0,0,0,0c-0.3,-0.3,-0.7,-0.7,-1,-1c0,0,0,0,0,0 C93.6,675.2,92.8,675,91.9,675z"
+ android:fillColor="#D86868"/>
+ <path
+ android:pathData="M135,832.8c1.3,0.1,2.6,0.3,3.9,0.4c0.9,0.8,2,0.7,3.1,0.6c13.1,2.2,26.4,3,39.6,4.1 c4.5,0.3,9,0.2,13.4,-0.5c3.1,0.3,6.3,0.7,9.4,0.8c22.6,0.4,45.2,-0.9,67.6,-4.1c23.9,-3.3,47.4,-8.2,69.8,-17.6 c10.7,-4.5,21.4,-9.3,29.3,-18.3l0,0.1c6.2,-4.6,8.5,-11.8,11.9,-18.2c5.2,4.3,3.3,10.1,2.2,15c-2.2,9.7,-9.6,15.7,-17.4,21 c-17.1,11.7,-36.5,18.1,-56.4,22.9c-19.3,4.7,-38.9,7.4,-58.7,9.3c-21.4,2,-42.8,2.5,-64.2,1.6c-20.3,-0.8,-40.5,-2.8,-60.6,-6.5 c-19,-3.5,-37.6,-8.2,-55.4,-15.4c-11.9,-4.8,-23.4,-10.6,-32.3,-20.2c-5.3,-5.8,-8.9,-12.4,-8.3,-20.6c0.1,-1.2,0,-2.4,1.1,-3.1 c3.3,3.1,4.1,7.8,7.2,11.1c9,9.9,20.2,16.3,32.4,21.4c16.8,7,34.3,11.7,52.3,14.5c0.6,0.1,1.2,0.2,1.9,0.3c0.9,0.8,2,0.7,3.1,0.6 c0.6,0.1,1.3,0.2,1.9,0.3C132.8,833,133.9,833,135,832.8z"
+ android:fillColor="#999899"/>
+ <path
+ android:pathData="M371.9,667c2.8,-3.5,0.4,-7.1,-0.3,-10.4c-5.7,-26.6,-17.7,-50.3,-34.2,-71.7c-0.8,-1,-1.5,-2.2,-2.3,-3.3 c-0.3,-0.5,-0.6,-1.1,-1,-1.9c3.4,3,6.9,5.4,9.6,8.6c10.8,13.1,20.4,27,27.7,42.4c8,16.9,13.1,34.6,15.8,53.1 c1.9,12.9,2.6,25.8,1.7,38.7c-1.7,22.4,-6,44.3,-14.7,65.1c-1.4,3.3,-3.1,6.6,-3,10.4c0,0,0,-0.1,0,-0.1c-1.8,-0.3,-3.3,0.4,-4.7,1.2 c-6.3,3.7,-12.6,7.3,-19.4,10.2c-24,10.3,-48.8,14.5,-74.7,9.2c-4.2,-0.9,-9.4,-0.2,-12.4,-4.8c13.8,-2,27.6,-4.4,41.1,-8 c10,-2.7,20,-5.4,29,-10.8c1.5,-0.5,3.2,-0.9,4.6,-1.6c10.6,-5.1,19.5,-12.1,25.3,-22.6c4.7,-3.1,8.2,-10.7,6.9,-15c0.3,-1.4,0.6,-2.9,1,-4.3 c5.4,-16.2,7.5,-33.1,9,-50C378,689.7,375.5,678.3,371.9,667z"
+ android:fillColor="#F1F0F0"/>
+ <path
+ android:pathData="M371.9,667c3.6,11.3,6.1,22.7,5.1,34.6c-1.5,16.9,-3.6,33.8,-9,50c-0.5,1.4,-0.7,2.9,-1,4.3 c-2.3,5,-4.6,10,-6.9,15c-5.8,10.5,-14.7,17.5,-25.3,22.6c-1.5,0.7,-3.1,1.1,-4.6,1.6c-0.3,-2.1,0.3,-3.9,1.1,-5.7 c3.4,-7.4,6.4,-14.9,8.9,-22.6c6,-18.1,10,-36.5,12,-55.6c1.2,-11.6,0.9,-23.2,0.6,-34.8c-0.2,-6.8,-0.7,-13.8,-2.8,-20.5 c2.4,-4.1,4.7,-8.1,7.1,-12.2c5.6,4.7,8.4,11.3,11.7,17.6C369.8,663.3,370.8,665.2,371.9,667z"
+ android:fillColor="#E6A3A3"/>
+ <path
+ android:pathData="M260,814c2.9,4.6,8.1,3.9,12.4,4.8c25.9,5.3,50.7,1.1,74.7,-9.2c6.7,-2.9,13.1,-6.4,19.4,-10.2 c1.4,-0.9,2.9,-1.6,4.7,-1.2c-7.9,9.1,-18.6,13.8,-29.3,18.3c-22.3,9.4,-45.9,14.3,-69.8,17.6c-22.4,3.1,-45,4.4,-67.6,4.1 c-3.1,-0.1,-6.3,-0.5,-9.4,-0.8c-0.1,-2,-1.4,-2.2,-3,-2.4c-28.3,-3,-56,-8.2,-82.4,-19.1c-13.4,-5.5,-26.5,-11.8,-35.3,-24.1c-1.3,-1.8,-2.4,-3.6,-2.2,-5.9 c15.1,11.6,32.9,16.7,51,21.1c17.7,4.4,35.8,6.6,54,8.3c10,0.9,20,1.1,29.8,1.1c15.7,0.1,31.5,0.4,47.1,-2.4 C256,814,258,814,260,814z"
+ android:fillColor="#EDECEC"/>
+ <path
+ android:pathData="M130,831.9c-1.1,0.1,-2.2,0.2,-3.1,-0.6C128.3,829.5,129.4,829.5,130,831.9z"
+ android:fillColor="#EDECEC"/>
+ <path
+ android:pathData="M135,832.8c-1.1,0.1,-2.2,0.2,-3.1,-0.7C133.4,830.5,134.4,830.6,135,832.8z"
+ android:fillColor="#EDECEC"/>
+ <path
+ android:pathData="M142,833.8c-1.1,0.1,-2.2,0.2,-3.1,-0.6C140.3,831.5,141.4,831.5,142,833.8z"
+ android:fillColor="#EDECEC"/>
+ <path
+ android:pathData="M260,814c-2,0,-4,0,-6,0c-6.8,-3.7,-13.9,-6.8,-20.5,-11c-18,-11.5,-32.7,-26.4,-45.1,-43.6c-11,-15.2,-21,-31,-27.5,-48.8 c-0.9,-2.5,-2,-4.9,-1.9,-7.7c0.7,0,1.4,-0.1,2,0.1c16.2,4.6,33.1,5.3,49.6,5.3c10,0,20.1,-0.2,30.2,-1.3c19.5,-2,38.7,-5.3,57,-12.4 c15.6,-6,30.1,-13.9,41.3,-26.9c4.7,-3.1,7,-8.3,11,-12c2.1,6.7,2.6,13.7,2.8,20.5c0.3,11.6,0.6,23.1,-0.6,34.8c-2,19,-6,37.5,-12,55.6 c-2.6,7.7,-5.5,15.3,-8.9,22.6c-0.9,1.9,-1.5,3.7,-1.1,5.7c-9,5.4,-19,8.1,-29,10.8C287.6,809.6,273.8,811.9,260,814z"
+ android:fillColor="#E6A3A3"/>
+ <path
+ android:pathData="M339,668c-11.1,13,-25.7,20.8,-41.3,26.9c-18.3,7.1,-37.5,10.4,-57,12.4c-10.1,1,-20.3,1.3,-30.2,1.3 c-16.6,0,-33.4,-0.7,-49.6,-5.3c-0.6,-0.2,-1.3,-0.1,-2,-0.1c-0.6,-0.4,-1.3,-0.7,-1.9,-1.1c-0.4,-3.8,0.3,-5,4.8,-4.2c12.1,2,24.3,2.8,36.5,3.4 c32.4,1.7,64.1,-2.3,95.1,-11.6c14.8,-4.5,29,-10.8,41.5,-20.1C336.3,668.5,337.5,667.9,339,668z"
+ android:fillColor="#FFFFFF"/>
+ <path
+ android:pathData="M96,678c1.6,0.2,3.7,-0.7,4,2C98.4,679.8,97,679.3,96,678z"
+ android:fillColor="#FFFFFF"/>
+ <path
+ android:pathData="M100,680c1.1,0,2.3,-0.2,3,1C101.9,681,100.7,681.2,100,680z"
+ android:fillColor="#FFFFFF"/>
+ <path
+ android:pathData="M91.9,675c0.8,0,1.6,0.2,2.1,1C93.2,676,92.4,675.8,91.9,675z"
+ android:fillColor="#FFFFFF"/>
+ <path
+ android:pathData="M94,676c0.3,0.3,0.7,0.7,1,1C94.7,676.7,94.3,676.3,94,676z"
+ android:fillColor="#FFFFFF"/>
+ <path
+ android:pathData="M95,677c0.3,0.3,0.7,0.7,1,1C95.7,677.7,95.3,677.3,95,677z"
+ android:fillColor="#C5C5C5"/>
+ <path
+ android:pathData="M360,771c2.3,-5,4.6,-10,6.9,-15C368.2,760.3,364.7,767.8,360,771z"
+ android:fillColor="#EDECEC"/>
+</vector>
diff --git a/packages/DocumentsUI/res/layout/directory_cluster.xml b/packages/DocumentsUI/res/layout/directory_cluster.xml
index 8245e53..2fa09d3 100644
--- a/packages/DocumentsUI/res/layout/directory_cluster.xml
+++ b/packages/DocumentsUI/res/layout/directory_cluster.xml
@@ -25,7 +25,7 @@
android:elevation="8dp"
android:background="@color/material_grey_50"/>
- <com.android.documentsui.DirectoryContainerView
+ <FrameLayout
android:id="@+id/container_directory"
android:layout_width="match_parent"
android:layout_height="0dp"
diff --git a/packages/DocumentsUI/res/values/strings.xml b/packages/DocumentsUI/res/values/strings.xml
index 3c49f16..b97918e 100644
--- a/packages/DocumentsUI/res/values/strings.xml
+++ b/packages/DocumentsUI/res/values/strings.xml
@@ -101,7 +101,7 @@
<!-- Toast shown when creating a folder failed with an error [CHAR LIMIT=48] -->
<string name="create_error">Failed to create folder</string>
<!-- Error message shown when querying for a list of documents failed [CHAR LIMIT=48] -->
- <string name="query_error">Failed to query documents</string>
+ <string name="query_error">Can\u2019t load content at the moment</string>
<!-- Title of storage root location that contains recently modified or used documents [CHAR LIMIT=24] -->
<string name="root_recent">Recent</string>
@@ -123,7 +123,7 @@
<string name="no_results">No matches in %1$s</string>
<!-- Toast shown when no app can be found to open the selected document [CHAR LIMIT=48] -->
- <string name="toast_no_application">Can\'t open file</string>
+ <string name="toast_no_application">Can\u2019t open file</string>
<!-- Toast shown when some of the selected documents failed to be deleted [CHAR LIMIT=48] -->
<string name="toast_failed_delete">Unable to delete some documents</string>
@@ -160,27 +160,27 @@
<string name="delete_preparing">Preparing for delete\u2026</string>
<!-- Title of the copy error notification [CHAR LIMIT=48] -->
<plurals name="copy_error_notification_title">
- <item quantity="one">Couldn\'t copy <xliff:g id="count" example="1">%1$d</xliff:g> file</item>
- <item quantity="other">Couldn\'t copy <xliff:g id="count" example="2">%1$d</xliff:g> files</item>
+ <item quantity="one">Couldn\u2019t copy <xliff:g id="count" example="1">%1$d</xliff:g> file</item>
+ <item quantity="other">Couldn\u2019t copy <xliff:g id="count" example="2">%1$d</xliff:g> files</item>
</plurals>
<!-- Title of the move error notification [CHAR LIMIT=48] -->
<plurals name="move_error_notification_title">
- <item quantity="one">Couldn\'t move <xliff:g id="count" example="1">%1$d</xliff:g> file</item>
- <item quantity="other">Couldn\'t move <xliff:g id="count" example="2">%1$d</xliff:g> files</item>
+ <item quantity="one">Couldn\u2019t move <xliff:g id="count" example="1">%1$d</xliff:g> file</item>
+ <item quantity="other">Couldn\u2019t move <xliff:g id="count" example="2">%1$d</xliff:g> files</item>
</plurals>
<!-- Title of the delete error notification [CHAR LIMIT=48] -->
<plurals name="delete_error_notification_title">
- <item quantity="one">Couldn\'t delete <xliff:g id="count" example="1">%1$d</xliff:g> file</item>
- <item quantity="other">Couldn\'t delete <xliff:g id="count" example="2">%1$d</xliff:g> files</item>
+ <item quantity="one">Couldn\u2019t delete <xliff:g id="count" example="1">%1$d</xliff:g> file</item>
+ <item quantity="other">Couldn\u2019t delete <xliff:g id="count" example="2">%1$d</xliff:g> files</item>
</plurals>
<!-- Second line for notifications saying that more information will be shown after touching [CHAR LIMIT=48] -->
<string name="notification_touch_for_details">Tap to view details</string>
<!-- Label of the close dialog button.[CHAR LIMIT=24] -->
<string name="close">Close</string>
<!-- Contents of the copying failure alert dialog. [CHAR LIMIT=48] -->
- <string name="copy_failure_alert_content">These files weren\'t copied: <xliff:g id="list">%1$s</xliff:g></string>
+ <string name="copy_failure_alert_content">These files weren\u2019t copied: <xliff:g id="list">%1$s</xliff:g></string>
<!-- Contents of the moving failure alert dialog. [CHAR LIMIT=48] -->
- <string name="move_failure_alert_content">These files weren\'t moved: <xliff:g id="list">%1$s</xliff:g></string>
+ <string name="move_failure_alert_content">These files weren\u2019t moved: <xliff:g id="list">%1$s</xliff:g></string>
<!-- Contents of the copying warning dialog due to converted files. [CHAR LIMIT=64] -->
<string name="copy_converted_warning_content">These files were converted to another format: <xliff:g id="list" example="Document.pdf, Photo.jpg, Song.ogg">%1$s</xliff:g></string>
<!-- Toast shown when a user copies files to clipboard. -->
diff --git a/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java b/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java
index e72343e..1e11b4e 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java
@@ -45,22 +45,16 @@
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Spinner;
-import android.widget.Toolbar;
-import com.android.documentsui.RecentsProvider.ResumeColumns;
import com.android.documentsui.SearchManager.SearchManagerListener;
import com.android.documentsui.State.ViewMode;
import com.android.documentsui.dirlist.DirectoryFragment;
import com.android.documentsui.model.DocumentInfo;
import com.android.documentsui.model.DocumentStack;
-import com.android.documentsui.model.DurableUtils;
import com.android.documentsui.model.RootInfo;
import com.android.internal.util.Preconditions;
-import libcore.io.IoUtils;
-
import java.io.FileNotFoundException;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -80,15 +74,14 @@
private final String mTag;
@LayoutRes
private int mLayoutId;
- private DirectoryContainerView mDirectoryContainer;
public abstract void onDocumentPicked(DocumentInfo doc, @Nullable SiblingProvider siblings);
public abstract void onDocumentsPicked(List<DocumentInfo> docs);
abstract void onTaskFinished(Uri... uris);
abstract void refreshDirectory(int anim);
- abstract void saveStackBlocking();
- abstract State buildState();
+ /** Allows sub-classes to include information in a newly created State instance. */
+ abstract void includeState(State initialState);
public BaseActivity(@LayoutRes int layoutId, String tag) {
mLayoutId = layoutId;
@@ -103,9 +96,7 @@
setContentView(mLayoutId);
mDrawer = DrawerController.create(this);
- mState = (icicle != null)
- ? icicle.<State>getParcelable(EXTRA_STATE)
- : buildState();
+ mState = getState(icicle);
Metrics.logActivityLaunch(this, mState, getIntent());
mRoots = DocumentsApplication.getRootsCache(this);
@@ -114,11 +105,11 @@
new RootsCache.OnCacheUpdateListener() {
@Override
public void onCacheUpdate() {
- new HandleRootsChangedTask().execute(getCurrentRoot());
+ new HandleRootsChangedTask(BaseActivity.this)
+ .execute(getCurrentRoot());
}
});
- mDirectoryContainer = (DirectoryContainerView) findViewById(R.id.container_directory);
mSearchManager = new SearchManager(this);
DocumentsToolbar toolbar = (DocumentsToolbar) findViewById(R.id.toolbar);
@@ -184,7 +175,20 @@
super.onDestroy();
}
- State buildDefaultState() {
+ private State getState(@Nullable Bundle icicle) {
+ if (icicle != null) {
+ State state = icicle.<State>getParcelable(EXTRA_STATE);
+ if (DEBUG) Log.d(mTag, "Recovered existing state object: " + state);
+ return state;
+ }
+
+ State state = createSharedState();
+ includeState(state);
+ if (DEBUG) Log.d(mTag, "Created new state object: " + state);
+ return state;
+ }
+
+ private State createSharedState() {
State state = new State();
final Intent intent = getIntent();
@@ -224,7 +228,7 @@
if (mRoots.isRecentsRoot(root)) {
refreshCurrentRootAndDirectory(ANIM_NONE);
} else {
- new PickRootTask(root).executeOnExecutor(getExecutorForCurrentDirectory());
+ new PickRootTask(this, root).executeOnExecutor(getExecutorForCurrentDirectory());
}
}
@@ -351,7 +355,6 @@
public final void refreshCurrentRootAndDirectory(int anim) {
mSearchManager.cancelSearch();
- mDirectoryContainer.setDrawDisappearingFirst(anim == ANIM_ENTER);
refreshDirectory(anim);
final RootsFragment roots = RootsFragment.get(getFragmentManager());
@@ -370,7 +373,6 @@
*/
@Override
public void onSearchChanged() {
- mDirectoryContainer.setDrawDisappearingFirst(false);
refreshDirectory(ANIM_NONE);
}
@@ -574,115 +576,40 @@
}
}
- final class PickRootTask extends AsyncTask<Void, Void, DocumentInfo> {
+ private static final class PickRootTask extends PairedTask<BaseActivity, Void, DocumentInfo> {
private RootInfo mRoot;
- public PickRootTask(RootInfo root) {
+ public PickRootTask(BaseActivity activity, RootInfo root) {
+ super(activity);
mRoot = root;
}
@Override
- protected DocumentInfo doInBackground(Void... params) {
- return getRootDocumentBlocking(mRoot);
+ protected DocumentInfo run(Void... params) {
+ return mOwner.getRootDocumentBlocking(mRoot);
}
@Override
- protected void onPostExecute(DocumentInfo result) {
- if (result != null && !isDestroyed()) {
- openContainerDocument(result);
+ protected void finish(DocumentInfo result) {
+ if (result != null) {
+ mOwner.openContainerDocument(result);
}
}
}
- final class RestoreStackTask extends AsyncTask<Void, Void, Void> {
- private volatile boolean mRestoredStack;
- private volatile boolean mExternal;
-
- @Override
- protected Void doInBackground(Void... params) {
- if (DEBUG && !mState.stack.isEmpty()) {
- Log.w(mTag, "Overwriting existing stack.");
- }
- RootsCache roots = DocumentsApplication.getRootsCache(BaseActivity.this);
-
- // Restore last stack for calling package
- final String packageName = getCallingPackageMaybeExtra();
- final Cursor cursor = getContentResolver()
- .query(RecentsProvider.buildResume(packageName), null, null, null, null);
- try {
- if (cursor.moveToFirst()) {
- mExternal = cursor.getInt(cursor.getColumnIndex(ResumeColumns.EXTERNAL)) != 0;
- final byte[] rawStack = cursor.getBlob(
- cursor.getColumnIndex(ResumeColumns.STACK));
- DurableUtils.readFromArray(rawStack, mState.stack);
- mRestoredStack = true;
- }
- } catch (IOException e) {
- Log.w(mTag, "Failed to resume: " + e);
- } finally {
- IoUtils.closeQuietly(cursor);
- }
-
- if (mRestoredStack) {
- // Update the restored stack to ensure we have freshest data
- final Collection<RootInfo> matchingRoots = roots.getMatchingRootsBlocking(mState);
- try {
- mState.stack.updateRoot(matchingRoots);
- mState.stack.updateDocuments(getContentResolver());
- } catch (FileNotFoundException e) {
- Log.w(mTag, "Failed to restore stack: " + e);
- mState.stack.reset();
- mRestoredStack = false;
- }
- }
-
- return null;
- }
-
- @Override
- protected void onPostExecute(Void result) {
- if (isDestroyed()) return;
- mState.restored = true;
- refreshCurrentRootAndDirectory(ANIM_NONE);
- onStackRestored(mRestoredStack, mExternal);
- }
- }
-
- final class RestoreRootTask extends AsyncTask<Void, Void, RootInfo> {
- private Uri mRootUri;
-
- public RestoreRootTask(Uri rootUri) {
- mRootUri = rootUri;
- }
-
- @Override
- protected RootInfo doInBackground(Void... params) {
- final String rootId = DocumentsContract.getRootId(mRootUri);
- return mRoots.getRootOneshot(mRootUri.getAuthority(), rootId);
- }
-
- @Override
- protected void onPostExecute(RootInfo root) {
- if (isDestroyed()) return;
- mState.restored = true;
-
- if (root != null) {
- onRootPicked(root);
- } else {
- Log.w(mTag, "Failed to find root: " + mRootUri);
- finish();
- }
- }
- }
-
- final class HandleRootsChangedTask extends AsyncTask<RootInfo, Void, RootInfo> {
+ private static final class HandleRootsChangedTask
+ extends PairedTask<BaseActivity, RootInfo, RootInfo> {
DocumentInfo mHome;
+ public HandleRootsChangedTask(BaseActivity activity) {
+ super(activity);
+ }
+
@Override
- protected RootInfo doInBackground(RootInfo... roots) {
+ protected RootInfo run(RootInfo... roots) {
checkArgument(roots.length == 1);
final RootInfo currentRoot = roots[0];
- final Collection<RootInfo> cachedRoots = mRoots.getRootsBlocking();
+ final Collection<RootInfo> cachedRoots = mOwner.mRoots.getRootsBlocking();
RootInfo homeRoot = null;
for (final RootInfo root : cachedRoots) {
if (root.isHome()) {
@@ -694,17 +621,17 @@
}
}
Preconditions.checkNotNull(homeRoot);
- mHome = getRootDocumentBlocking(homeRoot);
+ mHome = mOwner.getRootDocumentBlocking(homeRoot);
return homeRoot;
}
@Override
- protected void onPostExecute(RootInfo homeRoot) {
- if (homeRoot != null && mHome != null && !isDestroyed()) {
+ protected void finish(RootInfo homeRoot) {
+ if (homeRoot != null && mHome != null) {
// Clear entire backstack and start in new root
- mState.onRootChanged(homeRoot);
- mSearchManager.update(homeRoot);
- openContainerDocument(mHome);
+ mOwner.mState.onRootChanged(homeRoot);
+ mOwner.mSearchManager.update(homeRoot);
+ mOwner.openContainerDocument(mHome);
}
}
}
diff --git a/packages/DocumentsUI/src/com/android/documentsui/DirectoryContainerView.java b/packages/DocumentsUI/src/com/android/documentsui/DirectoryContainerView.java
deleted file mode 100644
index 71ea8a9..0000000
--- a/packages/DocumentsUI/src/com/android/documentsui/DirectoryContainerView.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2013 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.documentsui;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.FrameLayout;
-
-import java.util.ArrayList;
-
-public class DirectoryContainerView extends FrameLayout {
- private boolean mDisappearingFirst = false;
-
- public DirectoryContainerView(Context context) {
- super(context);
- }
-
- public DirectoryContainerView(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- @Override
- protected void dispatchDraw(Canvas canvas) {
- final ArrayList<View> disappearing = mDisappearingChildren;
- if (mDisappearingFirst && disappearing != null) {
- for (int i = 0; i < disappearing.size(); i++) {
- super.drawChild(canvas, disappearing.get(i), getDrawingTime());
- }
- }
- super.dispatchDraw(canvas);
- }
-
- @Override
- protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
- if (mDisappearingFirst && mDisappearingChildren != null
- && mDisappearingChildren.contains(child)) {
- return false;
- }
- return super.drawChild(canvas, child, drawingTime);
- }
-
- public void setDrawDisappearingFirst(boolean disappearingFirst) {
- mDisappearingFirst = disappearingFirst;
- }
-}
diff --git a/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java b/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java
index 815ff3d..5a092db 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java
@@ -16,6 +16,7 @@
package com.android.documentsui;
+import static com.android.documentsui.Shared.DEBUG;
import static com.android.documentsui.State.ACTION_CREATE;
import static com.android.documentsui.State.ACTION_GET_CONTENT;
import static com.android.documentsui.State.ACTION_OPEN;
@@ -31,11 +32,12 @@
import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.ContentValues;
+import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
+import android.database.Cursor;
import android.net.Uri;
-import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Parcelable;
import android.provider.DocumentsContract;
@@ -52,7 +54,12 @@
import com.android.documentsui.model.RootInfo;
import com.android.documentsui.services.FileOperationService;
+import libcore.io.IoUtils;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
public class DocumentsActivity extends BaseActivity {
@@ -94,16 +101,14 @@
// In this case, we set the activity title in AsyncTask.onPostExecute(). To prevent
// talkback from reading aloud the default title, we clear it here.
setTitle("");
- new RestoreStackTask().execute();
+ new RestoreStackTask(this).execute();
} else {
refreshCurrentRootAndDirectory(ANIM_NONE);
}
}
@Override
- State buildState() {
- State state = buildDefaultState();
-
+ void includeState(State state) {
final Intent intent = getIntent();
final String action = intent.getAction();
if (Intent.ACTION_OPEN_DOCUMENT.equals(action)) {
@@ -134,8 +139,6 @@
state.transferMode = intent.getIntExtra(FileOperationService.EXTRA_OPERATION,
FileOperationService.OPERATION_COPY);
}
-
- return state;
}
@Override
@@ -319,11 +322,13 @@
}
void onSaveRequested(DocumentInfo replaceTarget) {
- new ExistingFinishTask(replaceTarget.derivedUri).executeOnExecutor(getExecutorForCurrentDirectory());
+ new ExistingFinishTask(this, replaceTarget.derivedUri)
+ .executeOnExecutor(getExecutorForCurrentDirectory());
}
void onSaveRequested(String mimeType, String displayName) {
- new CreateFinishTask(mimeType, displayName).executeOnExecutor(getExecutorForCurrentDirectory());
+ new CreateFinishTask(this, mimeType, displayName)
+ .executeOnExecutor(getExecutorForCurrentDirectory());
}
@Override
@@ -343,7 +348,8 @@
openContainerDocument(doc);
} else if (mState.action == ACTION_OPEN || mState.action == ACTION_GET_CONTENT) {
// Explicit file picked, return
- new ExistingFinishTask(doc.derivedUri).executeOnExecutor(getExecutorForCurrentDirectory());
+ new ExistingFinishTask(this, doc.derivedUri)
+ .executeOnExecutor(getExecutorForCurrentDirectory());
} else if (mState.action == ACTION_CREATE) {
// Replace selected file
SaveFragment.get(fm).setReplaceTarget(doc);
@@ -358,7 +364,8 @@
for (int i = 0; i < size; i++) {
uris[i] = docs.get(i).derivedUri;
}
- new ExistingFinishTask(uris).executeOnExecutor(getExecutorForCurrentDirectory());
+ new ExistingFinishTask(this, uris)
+ .executeOnExecutor(getExecutorForCurrentDirectory());
}
}
@@ -373,11 +380,10 @@
// Should not be reached.
throw new IllegalStateException("Invalid mState.action.");
}
- new PickFinishTask(result).executeOnExecutor(getExecutorForCurrentDirectory());
+ new PickFinishTask(this, result).executeOnExecutor(getExecutorForCurrentDirectory());
}
- @Override
- void saveStackBlocking() {
+ void writeStackToRecentsBlocking() {
final ContentResolver resolver = getContentResolver();
final ContentValues values = new ContentValues();
@@ -438,69 +444,137 @@
finish();
}
+
public static DocumentsActivity get(Fragment fragment) {
return (DocumentsActivity) fragment.getActivity();
}
- private final class PickFinishTask extends AsyncTask<Void, Void, Void> {
+ /**
+ * Restores the stack from Recents for the specified package.
+ */
+ private static final class RestoreStackTask
+ extends PairedTask<DocumentsActivity, Void, Void> {
+
+ private volatile boolean mRestoredStack;
+ private volatile boolean mExternal;
+ private State mState;
+
+ public RestoreStackTask(DocumentsActivity activity) {
+ super(activity);
+ mState = activity.mState;
+ }
+
+ @Override
+ protected Void run(Void... params) {
+ if (DEBUG && !mState.stack.isEmpty()) {
+ Log.w(TAG, "Overwriting existing stack.");
+ }
+ RootsCache roots = DocumentsApplication.getRootsCache(mOwner);
+
+ String packageName = mOwner.getCallingPackageMaybeExtra();
+ Uri resumeUri = RecentsProvider.buildResume(packageName);
+ Cursor cursor = mOwner.getContentResolver().query(resumeUri, null, null, null, null);
+ try {
+ if (cursor.moveToFirst()) {
+ mExternal = cursor.getInt(cursor.getColumnIndex(ResumeColumns.EXTERNAL)) != 0;
+ final byte[] rawStack = cursor.getBlob(
+ cursor.getColumnIndex(ResumeColumns.STACK));
+ DurableUtils.readFromArray(rawStack, mState.stack);
+ mRestoredStack = true;
+ }
+ } catch (IOException e) {
+ Log.w(TAG, "Failed to resume: " + e);
+ } finally {
+ IoUtils.closeQuietly(cursor);
+ }
+
+ if (mRestoredStack) {
+ // Update the restored stack to ensure we have freshest data
+ final Collection<RootInfo> matchingRoots = roots.getMatchingRootsBlocking(mState);
+ try {
+ mState.stack.updateRoot(matchingRoots);
+ mState.stack.updateDocuments(mOwner.getContentResolver());
+ } catch (FileNotFoundException e) {
+ Log.w(TAG, "Failed to restore stack for package: " + packageName
+ + " because of error: "+ e);
+ mState.stack.reset();
+ mRestoredStack = false;
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ protected void finish(Void result) {
+ mState.restored = true;
+ mOwner.refreshCurrentRootAndDirectory(ANIM_NONE);
+ mOwner.onStackRestored(mRestoredStack, mExternal);
+ }
+ }
+
+ private static final class PickFinishTask extends PairedTask<DocumentsActivity, Void, Void> {
private final Uri mUri;
- public PickFinishTask(Uri uri) {
+ public PickFinishTask(DocumentsActivity activity, Uri uri) {
+ super(activity);
mUri = uri;
}
@Override
- protected Void doInBackground(Void... params) {
- saveStackBlocking();
+ protected Void run(Void... params) {
+ mOwner.writeStackToRecentsBlocking();
return null;
}
@Override
- protected void onPostExecute(Void result) {
- onTaskFinished(mUri);
+ protected void finish(Void result) {
+ mOwner.onTaskFinished(mUri);
}
}
- final class ExistingFinishTask extends AsyncTask<Void, Void, Void> {
+ private static final class ExistingFinishTask extends PairedTask<DocumentsActivity, Void, Void> {
private final Uri[] mUris;
- public ExistingFinishTask(Uri... uris) {
+ public ExistingFinishTask(DocumentsActivity activity, Uri... uris) {
+ super(activity);
mUris = uris;
}
@Override
- protected Void doInBackground(Void... params) {
- saveStackBlocking();
+ protected Void run(Void... params) {
+ mOwner.writeStackToRecentsBlocking();
return null;
}
@Override
- protected void onPostExecute(Void result) {
- onTaskFinished(mUris);
+ protected void finish(Void result) {
+ mOwner.onTaskFinished(mUris);
}
}
/**
* Task that creates a new document in the background.
*/
- final class CreateFinishTask extends AsyncTask<Void, Void, Uri> {
+ private static final class CreateFinishTask extends PairedTask<DocumentsActivity, Void, Uri> {
private final String mMimeType;
private final String mDisplayName;
- public CreateFinishTask(String mimeType, String displayName) {
+ public CreateFinishTask(DocumentsActivity activity, String mimeType, String displayName) {
+ super(activity);
mMimeType = mimeType;
mDisplayName = displayName;
}
@Override
- protected void onPreExecute() {
- setPending(true);
+ protected void prepare() {
+ mOwner.setPending(true);
}
@Override
- protected Uri doInBackground(Void... params) {
- final ContentResolver resolver = getContentResolver();
- final DocumentInfo cwd = getCurrentDirectory();
+ protected Uri run(Void... params) {
+ final ContentResolver resolver = mOwner.getContentResolver();
+ final DocumentInfo cwd = mOwner.getCurrentDirectory();
ContentProviderClient client = null;
Uri childUri = null;
@@ -516,22 +590,22 @@
}
if (childUri != null) {
- saveStackBlocking();
+ mOwner.writeStackToRecentsBlocking();
}
return childUri;
}
@Override
- protected void onPostExecute(Uri result) {
+ protected void finish(Uri result) {
if (result != null) {
- onTaskFinished(result);
+ mOwner.onTaskFinished(result);
} else {
Snackbars.makeSnackbar(
- DocumentsActivity.this, R.string.save_error, Snackbar.LENGTH_SHORT).show();
+ mOwner, R.string.save_error, Snackbar.LENGTH_SHORT).show();
}
- setPending(false);
+ mOwner.setPending(false);
}
}
}
diff --git a/packages/DocumentsUI/src/com/android/documentsui/DownloadsActivity.java b/packages/DocumentsUI/src/com/android/documentsui/DownloadsActivity.java
index 89be910..dae4bf7 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/DownloadsActivity.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/DownloadsActivity.java
@@ -24,8 +24,6 @@
import android.app.FragmentManager;
import android.content.ActivityNotFoundException;
import android.content.ClipData;
-import android.content.ContentResolver;
-import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
@@ -37,10 +35,8 @@
import android.view.MenuItem;
import android.widget.Toolbar;
-import com.android.documentsui.RecentsProvider.ResumeColumns;
import com.android.documentsui.dirlist.DirectoryFragment;
import com.android.documentsui.model.DocumentInfo;
-import com.android.documentsui.model.DurableUtils;
import com.android.documentsui.model.RootInfo;
import com.android.internal.util.Preconditions;
@@ -72,23 +68,19 @@
// talkback from reading aloud the default title, we clear it here.
setTitle("");
final Uri rootUri = getIntent().getData();
- new RestoreRootTask(rootUri).executeOnExecutor(getExecutorForCurrentDirectory());
+ new RestoreRootTask(this, rootUri).executeOnExecutor(getExecutorForCurrentDirectory());
} else {
refreshCurrentRootAndDirectory(ANIM_NONE);
}
}
@Override
- State buildState() {
- State state = buildDefaultState();
-
+ void includeState(State state) {
state.action = ACTION_MANAGE;
state.acceptMimes = new String[] { "*/*" };
state.allowMultiple = true;
state.showSize = true;
state.excludedAuthorities = getExcludedAuthorities();
-
- return state;
}
@Override
@@ -170,21 +162,6 @@
public void onDocumentsPicked(List<DocumentInfo> docs) {}
@Override
- void saveStackBlocking() {
- final ContentResolver resolver = getContentResolver();
- final ContentValues values = new ContentValues();
-
- final byte[] rawStack = DurableUtils.writeToArrayOrNull(mState.stack);
-
- // Remember location for next app launch
- final String packageName = getCallingPackageMaybeExtra();
- values.clear();
- values.put(ResumeColumns.STACK, rawStack);
- values.put(ResumeColumns.EXTERNAL, 0);
- resolver.insert(RecentsProvider.buildResume(packageName), values);
- }
-
- @Override
void onTaskFinished(Uri... uris) {
Log.d(TAG, "onFinished() " + Arrays.toString(uris));
diff --git a/packages/DocumentsUI/src/com/android/documentsui/FilesActivity.java b/packages/DocumentsUI/src/com/android/documentsui/FilesActivity.java
index 3aba356..c55f814 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/FilesActivity.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/FilesActivity.java
@@ -30,7 +30,6 @@
import android.content.ContentValues;
import android.content.Intent;
import android.net.Uri;
-import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Parcelable;
import android.provider.DocumentsContract;
@@ -98,19 +97,19 @@
refreshCurrentRootAndDirectory(ANIM_NONE);
} else if (intent.getAction() == Intent.ACTION_VIEW) {
checkArgument(uri != null);
- new OpenUriForViewTask().executeOnExecutor(
+ new OpenUriForViewTask(this).executeOnExecutor(
ProviderExecutor.forAuthority(uri.getAuthority()), uri);
} else if (DocumentsContract.isRootUri(this, uri)) {
if (DEBUG) Log.d(TAG, "Launching with root URI.");
// If we've got a specific root to display, restore that root using a dedicated
// authority. That way a misbehaving provider won't result in an ANR.
- new RestoreRootTask(uri).executeOnExecutor(
+ new RestoreRootTask(this, uri).executeOnExecutor(
ProviderExecutor.forAuthority(uri.getAuthority()));
} else {
if (DEBUG) Log.d(TAG, "Launching into Home directory.");
// If all else fails, try to load "Home" directory.
final Uri homeUri = DocumentsContract.buildHomeUri();
- new RestoreRootTask(homeUri).executeOnExecutor(
+ new RestoreRootTask(this, homeUri).executeOnExecutor(
ProviderExecutor.forAuthority(homeUri.getAuthority()));
}
@@ -134,9 +133,7 @@
}
@Override
- State buildState() {
- State state = buildDefaultState();
-
+ void includeState(State state) {
final Intent intent = getIntent();
state.action = State.ACTION_BROWSE;
@@ -149,8 +146,6 @@
if (stack != null) {
state.stack = stack;
}
-
- return state;
}
@Override
@@ -363,13 +358,15 @@
}
}
- @Override
- void saveStackBlocking() {
+ // Turns out only DocumentsActivity was ever calling saveStackBlocking.
+ // There may be a case where we want to contribute entries from
+ // Behavior here in FilesActivity, but it isn't yet obvious.
+ // TODO: Contribute to recents, or remove this.
+ void writeStackToRecentsBlocking() {
final ContentResolver resolver = getContentResolver();
final ContentValues values = new ContentValues();
- final byte[] rawStack = DurableUtils.writeToArrayOrNull(
- getDisplayState().stack);
+ final byte[] rawStack = DurableUtils.writeToArrayOrNull(mState.stack);
// Remember location for next app launch
final String packageName = getCallingPackageMaybeExtra();
@@ -408,12 +405,19 @@
* to know which root to select. Also, the stack doesn't contain intermediate directories.
* It's primarly used for opening ZIP archives from Downloads app.
*/
- final class OpenUriForViewTask extends AsyncTask<Uri, Void, Void> {
+ private static final class OpenUriForViewTask extends PairedTask<FilesActivity, Uri, Void> {
+
+ private final State mState;
+ public OpenUriForViewTask(FilesActivity activity) {
+ super(activity);
+ mState = activity.mState;
+ }
+
@Override
- protected Void doInBackground(Uri... params) {
+ protected Void run(Uri... params) {
final Uri uri = params[0];
- final RootsCache rootsCache = DocumentsApplication.getRootsCache(FilesActivity.this);
+ final RootsCache rootsCache = DocumentsApplication.getRootsCache(mOwner);
final String authority = uri.getAuthority();
final Collection<RootInfo> roots =
@@ -426,20 +430,17 @@
final RootInfo root = roots.iterator().next();
mState.stack.root = root;
try {
- mState.stack.add(DocumentInfo.fromUri(getContentResolver(), uri));
+ mState.stack.add(DocumentInfo.fromUri(mOwner.getContentResolver(), uri));
} catch (FileNotFoundException e) {
Log.e(TAG, "Failed to resolve DocumentInfo from Uri: " + uri);
}
- mState.stack.add(getRootDocumentBlocking(root));
+ mState.stack.add(mOwner.getRootDocumentBlocking(root));
return null;
}
@Override
- protected void onPostExecute(Void result) {
- if (isDestroyed()) {
- return;
- }
- refreshCurrentRootAndDirectory(ANIM_NONE);
+ protected void finish(Void result) {
+ mOwner.refreshCurrentRootAndDirectory(ANIM_NONE);
}
}
}
diff --git a/packages/DocumentsUI/src/com/android/documentsui/PairedTask.java b/packages/DocumentsUI/src/com/android/documentsui/PairedTask.java
new file mode 100644
index 0000000..b74acb8
--- /dev/null
+++ b/packages/DocumentsUI/src/com/android/documentsui/PairedTask.java
@@ -0,0 +1,77 @@
+/*
+ * 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.documentsui;
+
+import android.app.Activity;
+import android.os.AsyncTask;
+
+/**
+ * An {@link AsyncTask} that guards work with checks that a paired {@link Activity}
+ * is still alive. Instances of this class make no progress.
+ *
+ * <p>Use this type of task for greater safety when executing tasks that might complete
+ * after an Activity is destroyed.
+ *
+ * <p>Also useful as tasks can be static, limiting scope, but still have access to
+ * the owning class (by way the A template and the mActivity field).
+ *
+ * @template Owner Activity type.
+ * @template Input input type
+ * @template Output output type
+ */
+abstract class PairedTask<Owner extends Activity, Input, Output>
+ extends AsyncTask<Input, Void, Output> {
+
+ protected final Owner mOwner;
+
+ public PairedTask(Owner owner) {
+ mOwner = owner;
+ }
+
+ /** Called prior to run being executed. Analogous to {@link AsyncTask#onPreExecute} */
+ void prepare() {}
+
+ /** Analogous to {@link AsyncTask#doInBackground} */
+ abstract Output run(Input... input);
+
+ /** Analogous to {@link AsyncTask#onPostExecute} */
+ abstract void finish(Output output);
+
+ @Override
+ final protected void onPreExecute() {
+ if (mOwner.isDestroyed()) {
+ return;
+ }
+ prepare();
+ }
+
+ @Override
+ final protected Output doInBackground(Input... input) {
+ if (mOwner.isDestroyed()) {
+ return null;
+ }
+ return run(input);
+ }
+
+ @Override
+ final protected void onPostExecute(Output result) {
+ if (mOwner.isDestroyed()) {
+ return;
+ }
+ finish(result);
+ }
+}
diff --git a/packages/DocumentsUI/src/com/android/documentsui/RestoreRootTask.java b/packages/DocumentsUI/src/com/android/documentsui/RestoreRootTask.java
new file mode 100644
index 0000000..9048b9d
--- /dev/null
+++ b/packages/DocumentsUI/src/com/android/documentsui/RestoreRootTask.java
@@ -0,0 +1,52 @@
+/*
+ * 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.documentsui;
+
+import android.net.Uri;
+import android.provider.DocumentsContract;
+import android.util.Log;
+
+import com.android.documentsui.model.RootInfo;
+
+final class RestoreRootTask extends PairedTask<BaseActivity, Void, RootInfo> {
+ private static final String TAG = "RestoreRootTask";
+
+ private final Uri mRootUri;
+
+ public RestoreRootTask(BaseActivity activity, Uri rootUri) {
+ super(activity);
+ mRootUri = rootUri;
+ }
+
+ @Override
+ protected RootInfo run(Void... params) {
+ String rootId = DocumentsContract.getRootId(mRootUri);
+ return mOwner.mRoots.getRootOneshot(mRootUri.getAuthority(), rootId);
+ }
+
+ @Override
+ protected void finish(RootInfo root) {
+ mOwner.mState.restored = true;
+
+ if (root != null) {
+ mOwner.onRootPicked(root);
+ } else {
+ Log.w(TAG, "Failed to find root: " + mRootUri);
+ mOwner.finish();
+ }
+ }
+}
diff --git a/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java b/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java
index 1e3da6b..70bee3c 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java
@@ -100,7 +100,6 @@
import com.android.documentsui.model.RootInfo;
import com.android.documentsui.services.FileOperationService;
import com.android.documentsui.services.FileOperations;
-
import com.google.common.collect.Lists;
import java.util.ArrayList;
@@ -854,27 +853,28 @@
}
private void showEmptyDirectory() {
- showEmptyView(R.string.empty);
+ showEmptyView(R.string.empty, R.drawable.cabinet);
}
private void showNoResults(RootInfo root) {
CharSequence msg = getContext().getResources().getText(R.string.no_results);
- showEmptyView(String.format(String.valueOf(msg), root.title));
+ showEmptyView(String.format(String.valueOf(msg), root.title), R.drawable.cabinet);
}
- // Shows an error indicating documents couldn't be queried.
private void showQueryError() {
- showEmptyView(R.string.query_error);
+ showEmptyView(R.string.query_error, R.drawable.hourglass);
}
- private void showEmptyView(@StringRes int id) {
- showEmptyView(getContext().getResources().getText(id));
+ private void showEmptyView(@StringRes int id, int drawable) {
+ showEmptyView(getContext().getResources().getText(id), drawable);
}
- private void showEmptyView(CharSequence msg) {
+ private void showEmptyView(CharSequence msg, int drawable) {
View content = mEmptyView.findViewById(R.id.content);
TextView msgView = (TextView) mEmptyView.findViewById(R.id.message);
+ ImageView imageView = (ImageView) mEmptyView.findViewById(R.id.artwork);
msgView.setText(msg);
+ imageView.setImageResource(drawable);
content.animate().cancel(); // cancel any ongoing animations
diff --git a/packages/MtpDocumentsProvider/src/com/android/mtp/DocumentLoader.java b/packages/MtpDocumentsProvider/src/com/android/mtp/DocumentLoader.java
index 1829746b..ef1e8e2 100644
--- a/packages/MtpDocumentsProvider/src/com/android/mtp/DocumentLoader.java
+++ b/packages/MtpDocumentsProvider/src/com/android/mtp/DocumentLoader.java
@@ -24,9 +24,11 @@
import android.os.Bundle;
import android.os.Process;
import android.provider.DocumentsContract;
+import android.util.Log;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.LinkedList;
@@ -56,11 +58,17 @@
private static MtpObjectInfo[] loadDocuments(MtpManager manager, int deviceId, int[] handles)
throws IOException {
- final MtpObjectInfo[] objectInfos = new MtpObjectInfo[handles.length];
+ final ArrayList<MtpObjectInfo> objects = new ArrayList<>();
for (int i = 0; i < handles.length; i++) {
- objectInfos[i] = manager.getObjectInfo(deviceId, handles[i]);
+ final MtpObjectInfo info = manager.getObjectInfo(deviceId, handles[i]);
+ if (info == null) {
+ Log.e(MtpDocumentsProvider.TAG,
+ "Failed to obtain object info handle=" + handles[i]);
+ continue;
+ }
+ objects.add(info);
}
- return objectInfos;
+ return objects.toArray(new MtpObjectInfo[objects.size()]);
}
synchronized Cursor queryChildDocuments(String[] columnNames, Identifier parent)
diff --git a/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
index b44f9af..8a3ebefa 100644
--- a/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
+++ b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
@@ -577,9 +577,7 @@
static void getObjectDocumentValues(
ContentValues values, int deviceId, String parentId, MtpObjectInfo info) {
values.clear();
- final String mimeType = info.getFormat() == MtpConstants.FORMAT_ASSOCIATION ?
- DocumentsContract.Document.MIME_TYPE_DIR :
- MediaFile.getMimeTypeForFormatCode(info.getFormat());
+ final String mimeType = getMimeType(info);
int flag = 0;
if (info.getProtectionStatus() == 0) {
flag |= Document.FLAG_SUPPORTS_DELETE |
@@ -608,6 +606,17 @@
values.put(Document.COLUMN_SIZE, info.getCompressedSize());
}
+ private static String getMimeType(MtpObjectInfo info) {
+ if (info.getFormat() == MtpConstants.FORMAT_ASSOCIATION) {
+ return DocumentsContract.Document.MIME_TYPE_DIR;
+ }
+ final String formatCodeMimeType = MediaFile.getMimeTypeForFormatCode(info.getFormat());
+ if (formatCodeMimeType != null) {
+ return formatCodeMimeType;
+ }
+ return MediaFile.getMimeTypeForFile(info.getName());
+ }
+
static String[] strings(Object... args) {
final String[] results = new String[args.length];
for (int i = 0; i < args.length; i++) {
diff --git a/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
index 70a1aae..0338454 100644
--- a/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
+++ b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
@@ -184,6 +184,9 @@
public ParcelFileDescriptor openDocument(
String documentId, String mode, CancellationSignal signal)
throws FileNotFoundException {
+ if (DEBUG) {
+ Log.d(TAG, "openDocument: " + documentId);
+ }
final Identifier identifier = mDatabase.createIdentifier(documentId);
try {
openDevice(identifier.mDeviceId);
@@ -270,6 +273,9 @@
@Override
public String createDocument(String parentDocumentId, String mimeType, String displayName)
throws FileNotFoundException {
+ if (DEBUG) {
+ Log.d(TAG, "createDocument: " + displayName);
+ }
try {
final Identifier parentId = mDatabase.createIdentifier(parentDocumentId);
openDevice(parentId.mDeviceId);
diff --git a/packages/SystemUI/res/anim/recents_from_app_enter.xml b/packages/SystemUI/res/anim/recents_from_app_enter.xml
deleted file mode 100644
index 10ddce6..0000000
--- a/packages/SystemUI/res/anim/recents_from_app_enter.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, 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.
-*/
--->
-<!-- Recents Activity -->
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:shareInterpolator="false"
- android:zAdjustment="top">
- <alpha android:fromAlpha="1.0" android:toAlpha="1.0"
- android:fillEnabled="true"
- android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/fast_out_slow_in"
- android:duration="0"/>
-</set>
diff --git a/packages/SystemUI/res/anim/recents_from_app_exit.xml b/packages/SystemUI/res/anim/recents_from_app_exit.xml
deleted file mode 100644
index c98ecf4..0000000
--- a/packages/SystemUI/res/anim/recents_from_app_exit.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, 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.
-*/
--->
-<!-- Incoming Activity -->
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:shareInterpolator="false"
- android:zAdjustment="normal">
-
- <!-- Animate the view out only after recents is visible -->
- <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
- android:fillEnabled="true"
- android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/fast_out_slow_in"
- android:duration="1"/>
-</set>
diff --git a/packages/SystemUI/res/anim/recents_from_launcher_enter.xml b/packages/SystemUI/res/anim/recents_from_launcher_enter.xml
index b191e62..00b3dfd 100644
--- a/packages/SystemUI/res/anim/recents_from_launcher_enter.xml
+++ b/packages/SystemUI/res/anim/recents_from_launcher_enter.xml
@@ -23,6 +23,6 @@
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/linear"
+ android:interpolator="@android:interpolator/linear_out_slow_in"
android:duration="150"/>
</set>
diff --git a/packages/SystemUI/res/anim/recents_from_launcher_exit.xml b/packages/SystemUI/res/anim/recents_from_launcher_exit.xml
index fa6caf2..33831b8 100644
--- a/packages/SystemUI/res/anim/recents_from_launcher_exit.xml
+++ b/packages/SystemUI/res/anim/recents_from_launcher_exit.xml
@@ -23,6 +23,6 @@
<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/linear_out_slow_in"
- android:duration="150"/>
+ android:interpolator="@interpolator/recents_from_launcher_exit_interpolator"
+ android:duration="133"/>
</set>
diff --git a/packages/SystemUI/res/anim/recents_from_search_launcher_exit.xml b/packages/SystemUI/res/anim/recents_from_search_launcher_exit.xml
index e0e2fc8..23cedf8 100644
--- a/packages/SystemUI/res/anim/recents_from_search_launcher_exit.xml
+++ b/packages/SystemUI/res/anim/recents_from_search_launcher_exit.xml
@@ -23,6 +23,6 @@
<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/linear_out_slow_in"
- android:duration="@integer/recents_enter_from_home_transition_duration"/>
+ android:interpolator="@interpolator/recents_from_launcher_exit_interpolator"
+ android:duration="133"/>
</set>
diff --git a/packages/SystemUI/res/anim/recents_launch_from_launcher_enter.xml b/packages/SystemUI/res/anim/recents_launch_from_launcher_enter.xml
deleted file mode 100644
index 1135bc0..0000000
--- a/packages/SystemUI/res/anim/recents_launch_from_launcher_enter.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, 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.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:shareInterpolator="false"
- android:zAdjustment="normal">
- <!--scale android:fromXScale="2.0" android:toXScale="1.0"
- android:fromYScale="2.0" android:toYScale="1.0"
- android:interpolator="@android:interpolator/decelerate_cubic"
- android:fillEnabled="true"
- android:fillBefore="true" android:fillAfter="true"
- android:pivotX="50%p" android:pivotY="50%p"
- android:duration="250" /-->
-</set>
diff --git a/packages/SystemUI/res/anim/recents_launch_from_launcher_exit.xml b/packages/SystemUI/res/anim/recents_launch_from_launcher_exit.xml
deleted file mode 100644
index fa28cf4..0000000
--- a/packages/SystemUI/res/anim/recents_launch_from_launcher_exit.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, 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.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:shareInterpolator="false"
- android:zAdjustment="top">
- <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
- android:fillEnabled="true"
- android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/decelerate_cubic"
- android:duration="250"/>
-</set>
diff --git a/packages/SystemUI/res/anim/recents_return_to_launcher_exit.xml b/packages/SystemUI/res/anim/recents_return_to_launcher_exit.xml
deleted file mode 100644
index e95e667..0000000
--- a/packages/SystemUI/res/anim/recents_return_to_launcher_exit.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, 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.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:shareInterpolator="false"
- android:zAdjustment="normal">
- <!--scale android:fromXScale="1.0" android:toXScale="2.0"
- android:fromYScale="1.0" android:toYScale="2.0"
- android:interpolator="@android:interpolator/decelerate_cubic"
- android:pivotX="50%p" android:pivotY="50%p"
- android:duration="250" /-->
- <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
- android:interpolator="@android:interpolator/decelerate_cubic"
- android:duration="250"/>
-</set>
diff --git a/packages/SystemUI/res/anim/recents_to_launcher_enter.xml b/packages/SystemUI/res/anim/recents_to_launcher_enter.xml
index b191e62..544ec88 100644
--- a/packages/SystemUI/res/anim/recents_to_launcher_enter.xml
+++ b/packages/SystemUI/res/anim/recents_to_launcher_enter.xml
@@ -23,6 +23,6 @@
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/linear"
- android:duration="150"/>
+ android:interpolator="@interpolator/recents_to_launcher_enter_interpolator"
+ android:duration="133"/>
</set>
diff --git a/packages/SystemUI/res/anim/recents_to_launcher_exit.xml b/packages/SystemUI/res/anim/recents_to_launcher_exit.xml
index fa6caf2..226edb8 100644
--- a/packages/SystemUI/res/anim/recents_to_launcher_exit.xml
+++ b/packages/SystemUI/res/anim/recents_to_launcher_exit.xml
@@ -24,5 +24,5 @@
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
android:interpolator="@android:interpolator/linear_out_slow_in"
- android:duration="150"/>
+ android:duration="1"/>
</set>
diff --git a/packages/SystemUI/res/anim/recents_to_search_launcher_enter.xml b/packages/SystemUI/res/anim/recents_to_search_launcher_enter.xml
index ea82835..657b216 100644
--- a/packages/SystemUI/res/anim/recents_to_search_launcher_enter.xml
+++ b/packages/SystemUI/res/anim/recents_to_search_launcher_enter.xml
@@ -23,6 +23,6 @@
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/linear"
- android:duration="100"/>
+ android:interpolator="@interpolator/recents_to_launcher_enter_interpolator"
+ android:duration="133"/>
</set>
diff --git a/packages/SystemUI/res/anim/recents_to_search_launcher_exit.xml b/packages/SystemUI/res/anim/recents_to_search_launcher_exit.xml
index a8bdc8e..5182cab2 100644
--- a/packages/SystemUI/res/anim/recents_to_search_launcher_exit.xml
+++ b/packages/SystemUI/res/anim/recents_to_search_launcher_exit.xml
@@ -24,5 +24,5 @@
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
android:interpolator="@android:interpolator/linear"
- android:duration="100"/>
+ android:duration="1"/>
</set>
diff --git a/packages/SystemUI/res/anim/wallpaper_recents_launch_from_launcher_enter.xml b/packages/SystemUI/res/anim/wallpaper_recents_launch_from_launcher_enter.xml
deleted file mode 100644
index 73ae9f2..0000000
--- a/packages/SystemUI/res/anim/wallpaper_recents_launch_from_launcher_enter.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, 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.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:detachWallpaper="true"
- android:shareInterpolator="false"
- android:zAdjustment="normal">
- <!--scale android:fromXScale="2.0" android:toXScale="1.0"
- android:fromYScale="2.0" android:toYScale="1.0"
- android:interpolator="@android:interpolator/decelerate_cubic"
- android:fillEnabled="true"
- android:fillBefore="true" android:fillAfter="true"
- android:pivotX="50%p" android:pivotY="50%p"
- android:duration="250" /-->
- <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
- android:fillEnabled="true"
- android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/decelerate_cubic"
- android:duration="250"/>
-</set>
diff --git a/packages/SystemUI/res/anim/wallpaper_recents_launch_from_launcher_exit.xml b/packages/SystemUI/res/anim/wallpaper_recents_launch_from_launcher_exit.xml
deleted file mode 100644
index 7e257d9..0000000
--- a/packages/SystemUI/res/anim/wallpaper_recents_launch_from_launcher_exit.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, 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.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:detachWallpaper="true"
- android:shareInterpolator="false"
- android:zAdjustment="top">
- <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
- android:fillEnabled="true"
- android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/decelerate_cubic"
- android:duration="250"/>
-</set>
diff --git a/packages/SystemUI/res/anim/recents_return_to_launcher_enter.xml b/packages/SystemUI/res/interpolator/recents_from_launcher_exit_interpolator.xml
similarity index 62%
rename from packages/SystemUI/res/anim/recents_return_to_launcher_enter.xml
rename to packages/SystemUI/res/interpolator/recents_from_launcher_exit_interpolator.xml
index efa9019..4a7fff6 100644
--- a/packages/SystemUI/res/anim/recents_return_to_launcher_enter.xml
+++ b/packages/SystemUI/res/interpolator/recents_from_launcher_exit_interpolator.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
-** Copyright 2012, The Android Open Source Project
+** Copyright 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.
@@ -16,11 +16,8 @@
** limitations under the License.
*/
-->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:shareInterpolator="false"
- android:zAdjustment="normal">
- <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
- android:interpolator="@android:interpolator/decelerate_cubic"
- android:duration="250"/>
-</set>
+<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
+ android:controlX1="0"
+ android:controlY1="0"
+ android:controlX2="0.8"
+ android:controlY2="1" />
diff --git a/packages/SystemUI/res/anim/recents_return_to_launcher_enter.xml b/packages/SystemUI/res/interpolator/recents_to_launcher_enter_interpolator.xml
similarity index 62%
copy from packages/SystemUI/res/anim/recents_return_to_launcher_enter.xml
copy to packages/SystemUI/res/interpolator/recents_to_launcher_enter_interpolator.xml
index efa9019..c61dfd8 100644
--- a/packages/SystemUI/res/anim/recents_return_to_launcher_enter.xml
+++ b/packages/SystemUI/res/interpolator/recents_to_launcher_enter_interpolator.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
-** Copyright 2012, The Android Open Source Project
+** Copyright 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.
@@ -16,11 +16,8 @@
** limitations under the License.
*/
-->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:shareInterpolator="false"
- android:zAdjustment="normal">
- <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
- android:interpolator="@android:interpolator/decelerate_cubic"
- android:duration="250"/>
-</set>
+<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
+ android:controlX1="0.4"
+ android:controlY1="0"
+ android:controlX2="1"
+ android:controlY2="1" />
diff --git a/packages/SystemUI/res/layout/keyboard_shortcuts_wrapper.xml b/packages/SystemUI/res/layout/keyboard_shortcuts_category_separator.xml
similarity index 66%
rename from packages/SystemUI/res/layout/keyboard_shortcuts_wrapper.xml
rename to packages/SystemUI/res/layout/keyboard_shortcuts_category_separator.xml
index 802acfe..778ef8f 100644
--- a/packages/SystemUI/res/layout/keyboard_shortcuts_wrapper.xml
+++ b/packages/SystemUI/res/layout/keyboard_shortcuts_category_separator.xml
@@ -15,8 +15,11 @@
~ limitations under the License
-->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-</LinearLayout>
+<View xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:layout_marginStart="24dp"
+ android:layout_marginTop="8dp"
+ android:layout_marginEnd="0dp"
+ android:layout_marginBottom="20dp"
+ android:background="?android:attr/dividerHorizontal" />
diff --git a/packages/SystemUI/res/layout/keyboard_shortcuts_container.xml b/packages/SystemUI/res/layout/keyboard_shortcuts_container.xml
index fa07eb1..7ca3b95 100644
--- a/packages/SystemUI/res/layout/keyboard_shortcuts_container.xml
+++ b/packages/SystemUI/res/layout/keyboard_shortcuts_container.xml
@@ -16,7 +16,7 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="horizontal"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-</LinearLayout>
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
diff --git a/packages/SystemUI/res/layout/keyboard_shortcuts_view.xml b/packages/SystemUI/res/layout/keyboard_shortcuts_view.xml
index 77b1264..f73ee15 100644
--- a/packages/SystemUI/res/layout/keyboard_shortcuts_view.xml
+++ b/packages/SystemUI/res/layout/keyboard_shortcuts_view.xml
@@ -14,25 +14,35 @@
~ 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:id="@+id/keyboard_shortcuts_wrapper"
- android:layout_width="488dp"
+
+<FrameLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="488dp"
+ android:layout_height="wrap_content">
+ <LinearLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:focusable="true">
- <ScrollView
+ android:orientation="vertical">
+ <ScrollView
android:id="@+id/keyboard_shortcuts_scroll_view"
- android:layout_width="0dp"
- android:layout_height="0dp"
- android:layout_weight="1">
- <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <LinearLayout
android:id="@+id/keyboard_shortcuts_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"/>
- </ScrollView>
- <View
+ </ScrollView>
+ <!-- Required for stretching to full available height when the items in the scroll view
+ occupy less space then the full height -->
+ <View
android:layout_width="match_parent"
- android:layout_height="1dp"
- android:background="?android:attr/listDivider"/>
-</LinearLayout>
+ android:layout_height="0dp"
+ android:layout_weight="1"/>
+ </LinearLayout>
+ <View
+ android:layout_gravity="bottom"
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:background="?android:attr/dividerHorizontal"/>
+</FrameLayout>
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index 9bb6dc6..a9b8df2 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -158,5 +158,4 @@
<!-- Keyboard shortcuts colors -->
<color name="ksh_system_group_color">#ff00bcd4</color>
<color name="ksh_application_group_color">#fff44336</color>
- <color name="ksh_dialog_background_color">#ffffffff</color>
</resources>
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index e8df01b..083707a 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -138,12 +138,6 @@
<!-- The duration in seconds to wait before the dismiss buttons are shown. -->
<integer name="recents_task_bar_dismiss_delay_seconds">1000</integer>
- <!-- The duration of the window transition when coming to Recents from an app.
- In order to defer the in-app animations until after the transition is complete,
- we also need to use this value as the starting delay when animating the first
- task decorations in. -->
- <integer name="recents_enter_from_app_transition_duration">325</integer>
-
<!-- The duration for animating the task decorations in after transitioning from an app. -->
<integer name="recents_task_enter_from_app_duration">200</integer>
@@ -153,12 +147,6 @@
<!-- The duration for animating the task decorations out before transitioning to an app. -->
<integer name="recents_task_exit_to_app_duration">125</integer>
- <!-- The duration of the window transition when coming to Recents from the Launcher.
- In order to defer the in-app animations until after the transition is complete,
- we also need to use this value as the starting delay when animating the task views
- in from the bottom of the screen. -->
- <integer name="recents_enter_from_home_transition_duration">100</integer>
-
<!-- The min animation duration for animating the nav bar scrim in. -->
<integer name="recents_nav_bar_scrim_enter_duration">400</integer>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 76752e6..6ff9be1 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -1184,6 +1184,11 @@
<!-- Description for the toggle to set the initial scroll state to be paging or stack. DO NOT TRANSLATE -->
<string name="overview_initial_state_paging_desc">Determines whether Overview will initially be in a stacked or paged state</string>
+ <!-- Toggle to enable the gesture to enter split-screen by swiping up from the Overview button. [CHAR LIMIT=60]-->
+ <string name="overview_nav_bar_gesture">Enable split-screen swipe-up accelerator</string>
+ <!-- Description for the toggle to enable the gesture to enter split-screen by swiping up from the Overview button. [CHAR LIMIT=NONE]-->
+ <string name="overview_nav_bar_gesture_desc">Enable gesture to enter split-screen by swiping up from the Overview button</string>
+
<!-- Category in the System UI Tuner settings, where new/experimental
settings are -->
<string name="experimental">Experimental</string>
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index b078a68..60a9fc2 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -16,10 +16,6 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android">
- <style name="RecentsStyle" parent="@android:style/Theme.DeviceDefault.Wallpaper.NoTitleBar">
- <item name="android:windowAnimationStyle">@style/Animation.RecentsActivity</item>
- </style>
-
<style name="RecentsTheme" parent="@android:style/Theme.Material">
<!-- NoTitle -->
<item name="android:windowNoTitle">true</item>
@@ -27,38 +23,23 @@
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
- <item name="android:windowAnimationStyle">@style/Animation.RecentsActivity</item>
+ <item name="android:windowAnimationStyle">@null</item>
<item name="android:ambientShadowAlpha">0.35</item>
</style>
- <!-- Alternate Recents theme -->
+ <!-- Recents theme -->
<style name="RecentsTheme.Wallpaper">
- <!-- Wallpaper -->
<item name="android:windowBackground">@color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowShowWallpaper">true</item>
</style>
- <!-- Performance optimized alternate Recents theme (no wallpaper) -->
+ <!-- Performance optimized Recents theme (no wallpaper) -->
<style name="RecentsTheme.NoWallpaper">
<item name="android:windowBackground">@android:color/black</item>
</style>
- <!-- Animations for a non-full-screen window or activity. -->
- <style name="Animation.RecentsActivity" parent="@android:style/Animation.Activity">
- <item name="android:activityOpenEnterAnimation">@anim/recents_launch_from_launcher_enter</item>
- <item name="android:activityOpenExitAnimation">@anim/recents_launch_from_launcher_exit</item>
- <item name="android:taskOpenEnterAnimation">@anim/recents_launch_from_launcher_enter</item>
- <item name="android:taskOpenExitAnimation">@anim/recents_launch_from_launcher_exit</item>
- <item name="android:taskToFrontEnterAnimation">@anim/recents_launch_from_launcher_enter</item>
- <item name="android:taskToFrontExitAnimation">@anim/recents_launch_from_launcher_exit</item>
- <item name="android:wallpaperOpenEnterAnimation">@anim/recents_launch_from_launcher_enter</item>
- <item name="android:wallpaperOpenExitAnimation">@anim/recents_launch_from_launcher_exit</item>
- <item name="android:wallpaperIntraOpenEnterAnimation">@anim/wallpaper_recents_launch_from_launcher_enter</item>
- <item name="android:wallpaperIntraOpenExitAnimation">@anim/wallpaper_recents_launch_from_launcher_exit</item>
- </style>
-
<style name="TextAppearance.StatusBar.HeadsUp"
parent="@*android:style/TextAppearance.StatusBar">
</style>
diff --git a/packages/SystemUI/res/xml/tuner_prefs.xml b/packages/SystemUI/res/xml/tuner_prefs.xml
index febe518..4de4ced 100644
--- a/packages/SystemUI/res/xml/tuner_prefs.xml
+++ b/packages/SystemUI/res/xml/tuner_prefs.xml
@@ -122,6 +122,11 @@
android:title="@string/overview_fast_toggle_via_button"
android:summary="@string/overview_fast_toggle_via_button_desc" />
+ <com.android.systemui.tuner.TunerSwitch
+ android:key="overview_nav_bar_gesture"
+ android:title="@string/overview_nav_bar_gesture"
+ android:summary="@string/overview_nav_bar_gesture_desc" />
+
</PreferenceScreen>
<SwitchPreference
diff --git a/packages/SystemUI/src/com/android/systemui/Interpolators.java b/packages/SystemUI/src/com/android/systemui/Interpolators.java
index cd6dce0..5e33a9f 100644
--- a/packages/SystemUI/src/com/android/systemui/Interpolators.java
+++ b/packages/SystemUI/src/com/android/systemui/Interpolators.java
@@ -34,4 +34,10 @@
public static final Interpolator LINEAR = new LinearInterpolator();
public static final Interpolator ACCELERATE_DECELERATE = new AccelerateDecelerateInterpolator();
public static final Interpolator DECELERATE_QUINT = new DecelerateInterpolator(2.5f);
+
+ /**
+ * Interpolator to be used when animating a move based on a click. Pair with enough duration.
+ */
+ public static final Interpolator TOUCH_RESPONSE =
+ new PathInterpolator(0.3f, 0f, 0.1f, 1f);
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
index d01a288..3f482c8 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
@@ -45,7 +45,6 @@
import com.android.systemui.recents.events.activity.CancelEnterRecentsWindowAnimationEvent;
import com.android.systemui.recents.events.activity.DebugFlagsChangedEvent;
import com.android.systemui.recents.events.activity.DismissRecentsToHomeAnimationStarted;
-import com.android.systemui.recents.events.activity.EnterRecentsTaskStackAnimationCompletedEvent;
import com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent;
import com.android.systemui.recents.events.activity.EnterRecentsWindowLastAnimationFrameEvent;
import com.android.systemui.recents.events.activity.ExitRecentsWindowFirstAnimationFrameEvent;
@@ -130,6 +129,7 @@
*/
public FinishRecentsRunnable(Intent launchIntent, ActivityOptions opts) {
mLaunchIntent = launchIntent;
+ mOpts = opts;
}
@Override
@@ -437,11 +437,8 @@
protected void onPause() {
super.onPause();
- RecentsDebugFlags flags = Recents.getDebugFlags();
- if (flags.isFastToggleRecentsEnabled()) {
- // Stop the fast-toggle dozer
- mIterateTrigger.stopDozing();
- }
+ // Stop the fast-toggle dozer
+ mIterateTrigger.stopDozing();
}
@Override
@@ -648,6 +645,7 @@
}
public final void onBusEvent(UserInteractionEvent event) {
+ // Stop the fast-toggle dozer
mIterateTrigger.stopDozing();
}
@@ -694,21 +692,6 @@
}
}
- public final void onBusEvent(EnterRecentsTaskStackAnimationCompletedEvent event) {
- RecentsDebugFlags debugFlags = Recents.getDebugFlags();
- RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
- if (!launchState.launchedWithAltTab && debugFlags.isFastToggleRecentsEnabled() &&
- RecentsDebugFlags.Static.EnableFastToggleTimeoutOnEnter) {
- mIterateTrigger.setDozeDuration(
- getResources().getInteger(R.integer.recents_auto_advance_duration));
- if (!mIterateTrigger.isDozing()) {
- mIterateTrigger.startDozing();
- } else {
- mIterateTrigger.poke();
- }
- }
- }
-
public final void onBusEvent(EnterRecentsWindowLastAnimationFrameEvent event) {
EventBus.getDefault().send(new UpdateFreeformTaskViewVisibilityEvent(true));
mRecentsView.getViewTreeObserver().addOnPreDrawListener(this);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java
index 0afa1f6..177e841 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java
@@ -52,10 +52,23 @@
* Returns the task to focus given the current launch state.
*/
public int getInitialFocusTaskIndex(int numTasks) {
+ RecentsDebugFlags debugFlags = Recents.getDebugFlags();
if (launchedFromAppWithThumbnail) {
+ if (debugFlags.isFastToggleRecentsEnabled()) {
+ // If fast toggling, focus the front most task so that the next tap will focus the
+ // N-1 task
+ return numTasks - 1;
+ }
+
// If coming from another app, focus the next task
return numTasks - 2;
} else {
+ if (debugFlags.isFastToggleRecentsEnabled()) {
+ // If fast toggling, defer focusing until the next tap (which will automatically
+ // focus the front most task)
+ return -1;
+ }
+
// If coming from home, focus the first task
return numTasks - 1;
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java
index 6b8968f..fc14758 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java
@@ -39,8 +39,6 @@
public static final boolean EnableAffiliatedTaskGroups = true;
// Overrides the Tuner flags and enables the fast toggle and timeout
public static final boolean EnableFastToggleTimeoutOverride = true;
- // Enables toggling the fast-toggle timeout immediately after entering Recents
- public static final boolean EnableFastToggleTimeoutOnEnter = true;
// Enables us to create mock recents tasks
public static final boolean EnableMockTasks = false;
@@ -90,9 +88,6 @@
* @return whether the initial stack state is paging.
*/
public boolean isInitialStatePaging() {
- if (Static.EnableFastToggleTimeoutOnEnter) {
- return true;
- }
return mInitialStatePaging;
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
index 1cceef4..dd7b7c1 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
@@ -38,6 +38,7 @@
import android.view.AppTransitionAnimationSpec;
import android.view.LayoutInflater;
import android.view.View;
+import android.view.ViewConfiguration;
import com.android.internal.logging.MetricsLogger;
import com.android.systemui.Prefs;
@@ -48,6 +49,7 @@
import com.android.systemui.recents.events.activity.EnterRecentsWindowLastAnimationFrameEvent;
import com.android.systemui.recents.events.activity.HideRecentsEvent;
import com.android.systemui.recents.events.activity.IterateRecentsEvent;
+import com.android.systemui.recents.events.activity.LaunchNextTaskRequestEvent;
import com.android.systemui.recents.events.activity.RecentsActivityStartingEvent;
import com.android.systemui.recents.events.activity.ToggleRecentsEvent;
import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent;
@@ -81,8 +83,10 @@
public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener {
private final static String TAG = "RecentsImpl";
+
// The minimum amount of time between each recents button press that we will handle
private final static int MIN_TOGGLE_DELAY_MS = 350;
+
// The duration within which the user releasing the alt tab (from when they pressed alt tab)
// that the fast alt-tab animation will run. If the user's alt-tab takes longer than this
// duration, then we will toggle recents after this duration.
@@ -337,21 +341,31 @@
mTriggeredFromAltTab = false;
try {
+ ViewConfiguration viewConfig = ViewConfiguration.get(mContext);
SystemServicesProxy ssp = Recents.getSystemServices();
ActivityManager.RunningTaskInfo topTask = ssp.getTopMostTask();
MutableBoolean isTopTaskHome = new MutableBoolean(true);
+ long elapsedTime = SystemClock.elapsedRealtime() - mLastToggleTime;
+
if (topTask != null && ssp.isRecentsTopMost(topTask, isTopTaskHome)) {
RecentsConfiguration config = Recents.getConfiguration();
RecentsActivityLaunchState launchState = config.getLaunchState();
if (!launchState.launchedWithAltTab) {
- // Notify recents to move onto the next task
- EventBus.getDefault().post(new IterateRecentsEvent());
+ // If the user taps quickly
+ if (ViewConfiguration.getDoubleTapMinTime() < elapsedTime &&
+ elapsedTime < ViewConfiguration.getDoubleTapTimeout()) {
+ // Launch the next focused task
+ EventBus.getDefault().post(new LaunchNextTaskRequestEvent());
+ } else {
+ // Notify recents to move onto the next task
+ EventBus.getDefault().post(new IterateRecentsEvent());
+ }
} else {
// If the user has toggled it too quickly, then just eat up the event here (it's
// better than showing a janky screenshot).
// NOTE: Ideally, the screenshot mechanism would take the window transform into
// account
- if ((SystemClock.elapsedRealtime() - mLastToggleTime) < MIN_TOGGLE_DELAY_MS) {
+ if (elapsedTime < MIN_TOGGLE_DELAY_MS) {
return;
}
@@ -364,7 +378,7 @@
// better than showing a janky screenshot).
// NOTE: Ideally, the screenshot mechanism would take the window transform into
// account
- if ((SystemClock.elapsedRealtime() - mLastToggleTime) < MIN_TOGGLE_DELAY_MS) {
+ if (elapsedTime < MIN_TOGGLE_DELAY_MS) {
return;
}
@@ -551,11 +565,14 @@
public void dockTopTask(int topTaskId, int dragMode,
int stackCreateMode, Rect initialBounds) {
SystemServicesProxy ssp = Recents.getSystemServices();
+
+ // Make sure we inform DividerView before we actually start the activity so we can change
+ // the resize mode already.
+ EventBus.getDefault().send(new DockingTopTaskEvent(dragMode));
ssp.moveTaskToDockedStack(topTaskId, stackCreateMode, initialBounds);
showRecents(false /* triggeredFromAltTab */,
dragMode == NavigationBarGestureHelper.DRAG_MODE_RECENTS, false /* animate */,
true /* reloadTasks*/);
- EventBus.getDefault().send(new DockingTopTaskEvent(dragMode));
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/recents/events/activity/LaunchNextTaskRequestEvent.java b/packages/SystemUI/src/com/android/systemui/recents/events/activity/LaunchNextTaskRequestEvent.java
new file mode 100644
index 0000000..11604b5
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/recents/events/activity/LaunchNextTaskRequestEvent.java
@@ -0,0 +1,27 @@
+/*
+ * 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.recents.events.activity;
+
+import com.android.systemui.recents.events.EventBus;
+
+/**
+ * This event is sent to request that the next task is launched after a double-tap on the Recents
+ * button.
+ */
+public class LaunchNextTaskRequestEvent extends EventBus.Event {
+ // Simple event
+}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/events/activity/UndockingTaskEvent.java b/packages/SystemUI/src/com/android/systemui/recents/events/activity/UndockingTaskEvent.java
new file mode 100644
index 0000000..d5083a8
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/recents/events/activity/UndockingTaskEvent.java
@@ -0,0 +1,28 @@
+/*
+ * 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.recents.events.activity;
+
+import com.android.systemui.recents.events.EventBus;
+
+/**
+ * Fires when the user invoked the gesture to undock the task in the docked stack.
+ */
+public class UndockingTaskEvent extends EventBus.Event {
+
+ public UndockingTaskEvent() {
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryAdapter.java b/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryAdapter.java
index ee3eb02..5eeda72 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryAdapter.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryAdapter.java
@@ -67,9 +67,30 @@
public static class ViewHolder extends RecyclerView.ViewHolder implements Task.TaskCallbacks {
public final View content;
- public ViewHolder(View v) {
- super(v);
- content = v;
+ private Task mTask;
+
+ public ViewHolder(View content) {
+ super(content);
+ this.content = content;
+ }
+
+ /**
+ * Binds this view holder to the given task.
+ */
+ public void bindToTask(Task newTask) {
+ unbindFromTask();
+ mTask = newTask;
+ mTask.addCallback(this);
+ }
+
+ /**
+ * Unbinds this view holder from the
+ */
+ public void unbindFromTask() {
+ if (mTask != null) {
+ mTask.removeCallback(this);
+ mTask = null;
+ }
}
@Override
@@ -267,12 +288,13 @@
}
case TASK_ROW_VIEW_TYPE: {
TaskRow taskRow = (TaskRow) row;
- taskRow.task.addCallback(holder);
TextView tv = (TextView) holder.content.findViewById(R.id.description);
tv.setText(taskRow.task.title);
ImageView iv = (ImageView) holder.content.findViewById(R.id.icon);
iv.setAlpha(0f);
holder.content.setOnClickListener(taskRow);
+
+ holder.bindToTask(taskRow.task);
loader.loadTaskData(taskRow.task, false /* fetchAndInvalidateThumbnails */);
break;
}
@@ -289,7 +311,7 @@
if (viewType == TASK_ROW_VIEW_TYPE) {
TaskRow taskRow = (TaskRow) row;
loader.unloadTaskData(taskRow.task);
- taskRow.task.removeCallback(holder);
+ holder.unbindFromTask();
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/SystemBarScrimViews.java b/packages/SystemUI/src/com/android/systemui/recents/views/SystemBarScrimViews.java
index e8fa398..1cd0850 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/SystemBarScrimViews.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/SystemBarScrimViews.java
@@ -83,13 +83,11 @@
* going home).
*/
public final void onBusEvent(DismissRecentsToHomeAnimationStarted event) {
- int taskViewExitToAppDuration = mContext.getResources().getInteger(
- R.integer.recents_task_exit_to_app_duration);
if (mHasNavBarScrim && mShouldAnimateNavBarScrim) {
mNavBarScrimView.animate()
.translationY(mNavBarScrimView.getMeasuredHeight())
.setStartDelay(0)
- .setDuration(taskViewExitToAppDuration)
+ .setDuration(TaskStackAnimationHelper.EXIT_TO_HOME_TRANSLATION_DURATION)
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
.start();
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackAnimationHelper.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackAnimationHelper.java
index 0eae183..7eaa193 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackAnimationHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackAnimationHelper.java
@@ -108,7 +108,7 @@
return;
}
- int offscreenY = stackLayout.mStackRect.bottom;
+ int offscreenYOffset = stackLayout.mStackRect.height();
int taskViewAffiliateGroupEnterOffset = res.getDimensionPixelSize(
R.dimen.recents_task_view_affiliate_group_enter_offset);
@@ -145,7 +145,7 @@
} else if (launchState.launchedFromHome) {
// Move the task view off screen (below) so we can animate it in
RectF bounds = new RectF(mTmpTransform.rect);
- bounds.offsetTo(bounds.left, offscreenY);
+ bounds.offset(0, offscreenYOffset);
tv.setLeftTopRightBottom((int) bounds.left, (int) bounds.top, (int) bounds.right,
(int) bounds.bottom);
}
@@ -247,7 +247,7 @@
return;
}
- int offscreenY = stackLayout.mStackRect.bottom;
+ int offscreenYOffset = stackLayout.mStackRect.height();
// Create the animations for each of the tasks
List<TaskView> taskViews = mStackView.getTaskViews();
@@ -277,7 +277,7 @@
stackLayout.getStackTransform(task, stackScroller.getStackScroll(), mTmpTransform,
null);
- mTmpTransform.rect.offsetTo(mTmpTransform.rect.left, offscreenY);
+ mTmpTransform.rect.offset(0, offscreenYOffset);
mStackView.updateTaskViewToTransform(tv, mTmpTransform, taskAnimation);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
index 46fdb2a..bd37c3b 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
@@ -383,6 +383,7 @@
*/
void update(TaskStack stack, ArraySet<Task.TaskKey> ignoreTasksSet) {
SystemServicesProxy ssp = Recents.getSystemServices();
+ RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
// Clear the progress map
mTaskIndexMap.clear();
@@ -449,7 +450,6 @@
if (!ssp.hasFreeformWorkspaceSupport() && mNumStackTasks == 1) {
mInitialScrollP = mMinScrollP;
} else if (getDefaultFocusState() > 0f) {
- RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
if (launchState.launchedFromHome) {
mInitialScrollP = Math.max(mMinScrollP, Math.min(mMaxScrollP, launchTaskIndex));
} else {
@@ -568,7 +568,7 @@
boolean isFrontMostTaskInGroup = task.group == null || task.group.isFrontMostTask(task);
if (isFrontMostTaskInGroup) {
getStackTransform(taskProgress, mInitialScrollP, tmpTransform, null,
- false /* ignoreSingleTaskCase */);
+ false /* ignoreSingleTaskCase */, false /* forceUpdate */);
float screenY = tmpTransform.rect.top;
boolean hasVisibleThumbnail = (prevScreenY - screenY) > taskBarHeight;
if (hasVisibleThumbnail) {
@@ -601,6 +601,12 @@
*/
public TaskViewTransform getStackTransform(Task task, float stackScroll,
TaskViewTransform transformOut, TaskViewTransform frontTransform) {
+ return getStackTransform(task, stackScroll, transformOut, frontTransform,
+ false /* forceUpdate */);
+ }
+
+ public TaskViewTransform getStackTransform(Task task, float stackScroll,
+ TaskViewTransform transformOut, TaskViewTransform frontTransform, boolean forceUpdate) {
if (mFreeformLayoutAlgorithm.isTransformAvailable(task, this)) {
mFreeformLayoutAlgorithm.getTransform(task, transformOut, this);
return transformOut;
@@ -610,8 +616,9 @@
transformOut.reset();
return transformOut;
}
- return getStackTransform(mTaskIndexMap.get(task.key), stackScroll, transformOut,
- frontTransform, false /* ignoreSingleTaskCase */);
+ getStackTransform(mTaskIndexMap.get(task.key), stackScroll, transformOut,
+ frontTransform, false /* ignoreSingleTaskCase */, forceUpdate);
+ return transformOut;
}
}
@@ -635,9 +642,9 @@
* internally to ensure that we can calculate the transform for any
* position in the stack.
*/
- public TaskViewTransform getStackTransform(float taskProgress, float stackScroll,
+ public void getStackTransform(float taskProgress, float stackScroll,
TaskViewTransform transformOut, TaskViewTransform frontTransform,
- boolean ignoreSingleTaskCase) {
+ boolean ignoreSingleTaskCase, boolean forceUpdate) {
SystemServicesProxy ssp = Recents.getSystemServices();
// Compute the focused and unfocused offset
@@ -658,9 +665,9 @@
}
// Skip if the task is not visible
- if (!unfocusedVisible && !focusedVisible) {
+ if (!forceUpdate && !unfocusedVisible && !focusedVisible) {
transformOut.reset();
- return transformOut;
+ return;
}
int x = (mStackRect.width() - mTaskRect.width()) / 2;
@@ -700,7 +707,6 @@
transformOut.visible = (transformOut.rect.top < mStackRect.bottom) &&
(frontTransform == null || transformOut.rect.top != frontTransform.rect.top);
transformOut.p = relP;
- return transformOut;
}
/**
@@ -797,8 +803,10 @@
mFocusState * (mFocusedRange.relativeMin - mUnfocusedRange.relativeMin);
float max = mUnfocusedRange.relativeMax +
mFocusState * (mFocusedRange.relativeMax - mUnfocusedRange.relativeMax);
- getStackTransform(min, 0f, mBackOfStackTransform, null, true /* ignoreSingleTaskCase */);
- getStackTransform(max, 0f, mFrontOfStackTransform, null, true /* ignoreSingleTaskCase */);
+ getStackTransform(min, 0f, mBackOfStackTransform, null, true /* ignoreSingleTaskCase */,
+ true /* forceUpdate */);
+ getStackTransform(max, 0f, mFrontOfStackTransform, null, true /* ignoreSingleTaskCase */,
+ true /* forceUpdate */);
mBackOfStackTransform.visible = true;
mFrontOfStackTransform.visible = true;
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
index 1c97b5a..bb74de4 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -58,6 +58,7 @@
import com.android.systemui.recents.events.activity.HideHistoryButtonEvent;
import com.android.systemui.recents.events.activity.HideHistoryEvent;
import com.android.systemui.recents.events.activity.IterateRecentsEvent;
+import com.android.systemui.recents.events.activity.LaunchNextTaskRequestEvent;
import com.android.systemui.recents.events.activity.LaunchTaskEvent;
import com.android.systemui.recents.events.activity.LaunchTaskStartedEvent;
import com.android.systemui.recents.events.activity.PackagesChangedEvent;
@@ -654,7 +655,7 @@
transform.fillIn(tv);
} else {
mLayoutAlgorithm.getStackTransform(task, mStackScroller.getStackScroll(),
- transform, null);
+ transform, null, true /* forceUpdate */);
}
transform.visible = true;
}
@@ -1544,6 +1545,24 @@
mUIDozeTrigger.stopDozing();
}
+ public final void onBusEvent(LaunchNextTaskRequestEvent event) {
+ int launchTaskIndex = mStack.indexOfStackTask(mStack.getLaunchTarget());
+ if (launchTaskIndex != -1) {
+ launchTaskIndex = Math.max(0, launchTaskIndex - 1);
+ } else {
+ launchTaskIndex = mStack.getTaskCount() - 1;
+ }
+ if (launchTaskIndex != -1) {
+ // Stop all animations
+ mUIDozeTrigger.stopDozing();
+ cancelAllTaskViewAnimations();
+
+ Task launchTask = mStack.getStackTasks().get(launchTaskIndex);
+ EventBus.getDefault().send(new LaunchTaskEvent(getChildViewForTask(launchTask),
+ launchTask, null, INVALID_STACK_ID, false /* screenPinningRequested */));
+ }
+ }
+
public final void onBusEvent(LaunchTaskStartedEvent event) {
mAnimationHelper.startLaunchTaskAnimation(event.taskView, event.screenPinningRequested,
event.getAnimationTrigger());
@@ -1762,21 +1781,6 @@
}
}
- public final void onBusEvent(EnterRecentsTaskStackAnimationCompletedEvent event) {
- RecentsDebugFlags debugFlags = Recents.getDebugFlags();
- RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
- if (!launchState.launchedWithAltTab && debugFlags.isFastToggleRecentsEnabled() &&
- RecentsDebugFlags.Static.EnableFastToggleTimeoutOnEnter) {
- if (mFocusedTask != null) {
- int timerIndicatorDuration = getResources().getInteger(
- R.integer.recents_auto_advance_duration);
- int focusedTaskIndex = mStack.indexOfStackTask(mFocusedTask);
- setFocusedTask(focusedTaskIndex, false /* scrollToTask */,
- false /* requestViewFocus */, timerIndicatorDuration);
- }
- }
- }
-
public final void onBusEvent(UpdateFreeformTaskViewVisibilityEvent event) {
List<TaskView> taskViews = getTaskViews();
int taskViewCount = taskViews.size();
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 b8b5068..d6680fd 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
@@ -29,6 +29,7 @@
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewParent;
+import android.view.animation.Animation;
import android.view.animation.Interpolator;
import android.view.animation.PathInterpolator;
@@ -497,6 +498,7 @@
// onBeginDrag().
mSv.removeIgnoreTask(tv.getTask());
mSv.updateLayoutAlgorithm(false /* boundScroll */);
+ mSv.relayoutTaskViews(AnimationProps.IMMEDIATE);
mSwipeHelperAnimations.remove(v);
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
index 703005f..439d96f 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
@@ -242,7 +242,7 @@
}
void updateViewPropertiesToTaskTransform(TaskViewTransform toTransform,
- AnimationProps toAnimation, ValueAnimator.AnimatorUpdateListener updateCallback) {
+ AnimationProps toAnimation, ValueAnimator.AnimatorUpdateListener updateCallback) {
RecentsConfiguration config = Recents.getConfiguration();
cancelTransformAnimation();
@@ -261,14 +261,16 @@
updateCallback.onAnimationUpdate(null);
}
} else {
+ // Both the progress and the update are a function of the bounds movement of the task
if (Float.compare(getTaskProgress(), toTransform.p) != 0) {
- mTmpAnimators.add(ObjectAnimator.ofFloat(this, TASK_PROGRESS, getTaskProgress(),
- toTransform.p));
+ ObjectAnimator anim = ObjectAnimator.ofFloat(this, TASK_PROGRESS, getTaskProgress(),
+ toTransform.p);
+ mTmpAnimators.add(toAnimation.apply(AnimationProps.BOUNDS, anim));
}
if (updateCallback != null) {
ValueAnimator updateCallbackAnim = ValueAnimator.ofInt(0, 1);
updateCallbackAnim.addUpdateListener(updateCallback);
- mTmpAnimators.add(updateCallbackAnim);
+ mTmpAnimators.add(toAnimation.apply(AnimationProps.BOUNDS, updateCallbackAnim));
}
// Create the animator
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerHandleView.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerHandleView.java
index 5ef56f3..12e2713 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerHandleView.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerHandleView.java
@@ -26,10 +26,9 @@
import android.graphics.Paint;
import android.util.AttributeSet;
import android.util.Property;
-import android.view.animation.AnimationUtils;
-import android.view.animation.Interpolator;
import android.widget.ImageButton;
+import com.android.systemui.Interpolators;
import com.android.systemui.R;
/**
@@ -71,7 +70,6 @@
private final int mWidth;
private final int mHeight;
private final int mCircleDiameter;
- private final Interpolator mFastOutSlowInInterpolator;
private int mCurrentWidth;
private int mCurrentHeight;
private AnimatorSet mAnimator;
@@ -85,8 +83,6 @@
mCurrentWidth = mWidth;
mCurrentHeight = mHeight;
mCircleDiameter = (mWidth + mHeight) / 3;
- mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(getContext(),
- android.R.interpolator.fast_out_slow_in);
}
public void setTouching(boolean touching, boolean animate) {
@@ -120,8 +116,8 @@
? DividerView.TOUCH_ANIMATION_DURATION
: DividerView.TOUCH_RELEASE_ANIMATION_DURATION);
mAnimator.setInterpolator(touching
- ? DividerView.TOUCH_RESPONSE_INTERPOLATOR
- : mFastOutSlowInInterpolator);
+ ? Interpolators.TOUCH_RESPONSE
+ : Interpolators.FAST_OUT_SLOW_IN);
mAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
index 1e11fa8..83c22b1 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
@@ -48,10 +48,12 @@
import com.android.internal.policy.DividerSnapAlgorithm;
import com.android.internal.policy.DividerSnapAlgorithm.SnapTarget;
import com.android.internal.policy.DockedDividerUtils;
+import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.events.activity.DockingTopTaskEvent;
import com.android.systemui.recents.events.activity.RecentsActivityStartingEvent;
+import com.android.systemui.recents.events.activity.UndockingTaskEvent;
import com.android.systemui.recents.events.ui.RecentsDrawnEvent;
import com.android.systemui.statusbar.FlingAnimationUtils;
import com.android.systemui.statusbar.phone.NavigationBarGestureHelper;
@@ -67,8 +69,6 @@
static final long TOUCH_ANIMATION_DURATION = 150;
static final long TOUCH_RELEASE_ANIMATION_DURATION = 200;
- static final Interpolator TOUCH_RESPONSE_INTERPOLATOR =
- new PathInterpolator(0.3f, 0f, 0.1f, 1f);
private static final String TAG = "DividerView";
@@ -116,7 +116,6 @@
private final Rect mOtherInsetRect = new Rect();
private final Rect mLastResizeRect = new Rect();
private final WindowManagerProxy mWindowManagerProxy = WindowManagerProxy.getInstance();
- private Interpolator mFastOutSlowInInterpolator;
private DividerWindowManager mWindowManager;
private VelocityTracker mVelocityTracker;
private FlingAnimationUtils mFlingAnimationUtils;
@@ -158,8 +157,6 @@
mTouchElevation = getResources().getDimensionPixelSize(
R.dimen.docked_stack_divider_lift_elevation);
mGrowRecents = getResources().getBoolean(R.bool.recents_grow_in_multiwindow);
- mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(getContext(),
- android.R.interpolator.fast_out_slow_in);
mTouchSlop = ViewConfiguration.get(mContext).getScaledTouchSlop();
mFlingAnimationUtils = new FlingAnimationUtils(getContext(), 0.3f);
updateDisplayInfo();
@@ -192,7 +189,7 @@
insets.getStableInsetRight(), insets.getStableInsetBottom());
if (mSnapAlgorithm != null) {
mSnapAlgorithm = null;
- getSnapAlgorithm();
+ initializeSnapAlgorithm();
}
}
return super.onApplyWindowInsets(insets);
@@ -211,17 +208,13 @@
mHandle.setTouching(true, animate);
}
mDockSide = mWindowManagerProxy.getDockSide();
- getSnapAlgorithm();
- if (mDockSide != WindowManager.DOCKED_INVALID) {
- mWindowManagerProxy.setResizing(true);
- mWindowManager.setSlippery(false);
- if (touching) {
- liftBackground();
- }
- return true;
- } else {
- return false;
+ initializeSnapAlgorithm();
+ mWindowManagerProxy.setResizing(true);
+ mWindowManager.setSlippery(false);
+ if (touching) {
+ liftBackground();
}
+ return mDockSide != WindowManager.DOCKED_INVALID;
}
public void stopDragging(int position, float velocity, boolean avoidDismissStart) {
@@ -233,17 +226,36 @@
public void stopDragging(int position, SnapTarget target, long duration,
Interpolator interpolator) {
+ stopDragging(position, target, duration, 0 /* startDelay*/, interpolator);
+ }
+
+ public void stopDragging(int position, SnapTarget target, long duration, long startDelay,
+ Interpolator interpolator) {
mHandle.setTouching(false, true /* animate */);
- flingTo(position, target, duration, interpolator);
+ flingTo(position, target, duration, startDelay, interpolator);
mWindowManager.setSlippery(true);
releaseBackground();
}
- public DividerSnapAlgorithm getSnapAlgorithm() {
+ private void stopDragging() {
+ mHandle.setTouching(false, true /* animate */);
+ mWindowManager.setSlippery(true);
+ releaseBackground();
+ }
+
+ private void updateDockSide() {
+ mDockSide = mWindowManagerProxy.getDockSide();
+ }
+
+ private void initializeSnapAlgorithm() {
if (mSnapAlgorithm == null) {
mSnapAlgorithm = new DividerSnapAlgorithm(getContext().getResources(), mDisplayWidth,
mDisplayHeight, mDividerSize, isHorizontalDivision(), mStableInsets);
}
+ }
+
+ public DividerSnapAlgorithm getSnapAlgorithm() {
+ initializeSnapAlgorithm();
return mSnapAlgorithm;
}
@@ -267,6 +279,11 @@
mStartX = (int) event.getX();
mStartY = (int) event.getY();
boolean result = startDragging(true /* animate */, true /* touching */);
+ if (!result) {
+
+ // Weren't able to start dragging successfully, so cancel it again.
+ stopDragging();
+ }
mStartPosition = getCurrentPosition();
mMoving = false;
return result;
@@ -320,10 +337,11 @@
anim.start();
}
- private void flingTo(int position, SnapTarget target, long duration,
+ private void flingTo(int position, SnapTarget target, long duration, long startDelay,
Interpolator interpolator) {
ValueAnimator anim = getFlingAnimator(position, target);
anim.setDuration(duration);
+ anim.setStartDelay(startDelay);
anim.setInterpolator(interpolator);
anim.start();
}
@@ -377,7 +395,7 @@
mBackground.animate().scaleX(1.4f);
}
mBackground.animate()
- .setInterpolator(TOUCH_RESPONSE_INTERPOLATOR)
+ .setInterpolator(Interpolators.TOUCH_RESPONSE)
.setDuration(TOUCH_ANIMATION_DURATION)
.translationZ(mTouchElevation)
.start();
@@ -385,7 +403,7 @@
// Lift handle as well so it doesn't get behind the background, even though it doesn't
// cast shadow.
mHandle.animate()
- .setInterpolator(TOUCH_RESPONSE_INTERPOLATOR)
+ .setInterpolator(Interpolators.TOUCH_RESPONSE)
.setDuration(TOUCH_ANIMATION_DURATION)
.translationZ(mTouchElevation)
.start();
@@ -393,14 +411,14 @@
private void releaseBackground() {
mBackground.animate()
- .setInterpolator(mFastOutSlowInInterpolator)
+ .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
.setDuration(TOUCH_RELEASE_ANIMATION_DURATION)
.translationZ(0)
.scaleX(1f)
.scaleY(1f)
.start();
mHandle.animate()
- .setInterpolator(mFastOutSlowInInterpolator)
+ .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
.setDuration(TOUCH_RELEASE_ANIMATION_DURATION)
.translationZ(0)
.start();
@@ -421,6 +439,7 @@
mDisplayWidth = info.logicalWidth;
mDisplayHeight = info.logicalHeight;
mSnapAlgorithm = null;
+ initializeSnapAlgorithm();
}
private int calculatePosition(int touchX, int touchY) {
@@ -725,13 +744,29 @@
public final void onBusEvent(RecentsDrawnEvent drawnEvent) {
if (mAnimateAfterRecentsDrawn) {
mAnimateAfterRecentsDrawn = false;
+ updateDockSide();
stopDragging(getCurrentPosition(), mSnapAlgorithm.getMiddleTarget(), 250,
- TOUCH_RESPONSE_INTERPOLATOR);
+ Interpolators.TOUCH_RESPONSE);
}
if (mGrowAfterRecentsDrawn) {
mGrowAfterRecentsDrawn = false;
+ updateDockSide();
stopDragging(getCurrentPosition(), mSnapAlgorithm.getMiddleTarget(), 250,
- TOUCH_RESPONSE_INTERPOLATOR);
+ Interpolators.TOUCH_RESPONSE);
+ }
+ }
+
+ public final void onBusEvent(UndockingTaskEvent undockingTaskEvent) {
+ int dockSide = mWindowManagerProxy.getDockSide();
+ if (dockSide != WindowManager.DOCKED_INVALID) {
+ startDragging(false /* animate */, false /* touching */);
+ SnapTarget target = dockSideTopLeft(dockSide)
+ ? mSnapAlgorithm.getDismissEndTarget()
+ : mSnapAlgorithm.getDismissStartTarget();
+
+ // Don't start immediately - give a little bit time to settle the drag resize change.
+ stopDragging(getCurrentPosition(), target, 336 /* duration */, 100 /* startDelay */,
+ Interpolators.TOUCH_RESPONSE);
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java b/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java
index 24ab506..15bcaf8 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java
@@ -97,7 +97,7 @@
@Override
public void run() {
try {
- ActivityManagerNative.getDefault().resizeStack(DOCKED_STACK_ID, null, true, false,
+ ActivityManagerNative.getDefault().resizeStack(DOCKED_STACK_ID, null, true, true,
false);
} catch (RemoteException e) {
Log.w(TAG, "Failed to resize stack: " + e);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java
index 963920c..0b7bfa8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java
@@ -23,17 +23,15 @@
import android.content.DialogInterface.OnClickListener;
import android.os.Handler;
import android.os.Looper;
-import android.util.DisplayMetrics;
+import android.view.ContextThemeWrapper;
import android.view.KeyEvent;
import android.view.KeyboardShortcutGroup;
import android.view.KeyboardShortcutInfo;
import android.view.LayoutInflater;
import android.view.View;
-import android.view.ViewGroup.LayoutParams;
import android.view.Window;
import android.view.WindowManager.KeyboardShortcutsReceiver;
import android.widget.LinearLayout;
-import android.widget.ScrollView;
import android.widget.TextView;
import com.android.systemui.R;
@@ -65,7 +63,7 @@
private Dialog mKeyboardShortcutsDialog;
public KeyboardShortcuts(Context context) {
- this.mContext = context;
+ this.mContext = new ContextThemeWrapper(context, android.R.style.Theme_Material_Light);
}
public void toggleKeyboardShortcuts() {
@@ -108,40 +106,28 @@
mHandler.post(new Runnable() {
@Override
public void run() {
- // TODO: break all this code out into a handleShowKeyboard...
- // Might add more things posted; should consider adding a custom handler so
- // you can send the keyboardShortcutsGroups as part of the message.
- AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(mContext);
- LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(
- LAYOUT_INFLATER_SERVICE);
- final View keyboardShortcutsView = inflater.inflate(
- R.layout.keyboard_shortcuts_view, null);
- DisplayMetrics dm = mContext.getResources().getDisplayMetrics();
- ScrollView scrollView = (ScrollView) keyboardShortcutsView.findViewById(
- R.id.keyboard_shortcuts_scroll_view);
- // TODO: find a better way to set the height.
- scrollView.setLayoutParams(new LinearLayout.LayoutParams(
- LayoutParams.WRAP_CONTENT,
- (int) (dm.heightPixels * dm.density)));
-
- populateKeyboardShortcuts((LinearLayout) keyboardShortcutsView.findViewById(
- R.id.keyboard_shortcuts_container), keyboardShortcutGroups);
- dialogBuilder.setView(keyboardShortcutsView);
- dialogBuilder.setPositiveButton(R.string.quick_settings_done, dialogCloseListener);
- mKeyboardShortcutsDialog = dialogBuilder.create();
- mKeyboardShortcutsDialog.setCanceledOnTouchOutside(true);
-
- // Setup window.
- Window keyboardShortcutsWindow = mKeyboardShortcutsDialog.getWindow();
- keyboardShortcutsWindow.setType(TYPE_SYSTEM_DIALOG);
- keyboardShortcutsWindow.setBackgroundDrawable(
- mContext.getDrawable(R.color.ksh_dialog_background_color));
- keyboardShortcutsWindow.setGravity(TOP);
- mKeyboardShortcutsDialog.show();
+ handleShowKeyboardShortcuts(keyboardShortcutGroups);
}
});
}
+ private void handleShowKeyboardShortcuts(List<KeyboardShortcutGroup> keyboardShortcutGroups) {
+ AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(mContext);
+ LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(
+ LAYOUT_INFLATER_SERVICE);
+ final View keyboardShortcutsView = inflater.inflate(
+ R.layout.keyboard_shortcuts_view, null);
+ populateKeyboardShortcuts((LinearLayout) keyboardShortcutsView.findViewById(
+ R.id.keyboard_shortcuts_container), keyboardShortcutGroups);
+ dialogBuilder.setView(keyboardShortcutsView);
+ dialogBuilder.setPositiveButton(R.string.quick_settings_done, dialogCloseListener);
+ mKeyboardShortcutsDialog = dialogBuilder.create();
+ mKeyboardShortcutsDialog.setCanceledOnTouchOutside(true);
+ Window keyboardShortcutsWindow = mKeyboardShortcutsDialog.getWindow();
+ keyboardShortcutsWindow.setType(TYPE_SYSTEM_DIALOG);
+ mKeyboardShortcutsDialog.show();
+ }
+
private void populateKeyboardShortcuts(LinearLayout keyboardShortcutsLayout,
List<KeyboardShortcutGroup> keyboardShortcutGroups) {
LayoutInflater inflater = LayoutInflater.from(mContext);
@@ -156,36 +142,37 @@
: mContext.getColor(R.color.ksh_application_group_color));
keyboardShortcutsLayout.addView(categoryTitle);
- LinearLayout shortcutWrapper = (LinearLayout) inflater.inflate(
- R.layout.keyboard_shortcuts_wrapper, null);
+ LinearLayout shortcutContainer = (LinearLayout) inflater.inflate(
+ R.layout.keyboard_shortcuts_container, keyboardShortcutsLayout, false);
final int itemsSize = group.getItems().size();
for (int j = 0; j < itemsSize; j++) {
KeyboardShortcutInfo info = group.getItems().get(j);
- View shortcutView = inflater.inflate(R.layout.keyboard_shortcut_app_item, null);
+ View shortcutView = inflater.inflate(R.layout.keyboard_shortcut_app_item,
+ shortcutContainer, false);
TextView textView = (TextView) shortcutView
.findViewById(R.id.keyboard_shortcuts_keyword);
textView.setText(info.getLabel());
+ LinearLayout shortcutItemsContainer = (LinearLayout) shortcutView
+ .findViewById(R.id.keyboard_shortcuts_item_container);
List<String> shortcutKeys = getHumanReadableShortcutKeys(info);
final int shortcutKeysSize = shortcutKeys.size();
for (int k = 0; k < shortcutKeysSize; k++) {
String shortcutKey = shortcutKeys.get(k);
TextView shortcutKeyView = (TextView) inflater.inflate(
- R.layout.keyboard_shortcuts_key_view, null);
+ R.layout.keyboard_shortcuts_key_view, shortcutItemsContainer, false);
shortcutKeyView.setText(shortcutKey);
- LinearLayout shortcutItemsContainer = (LinearLayout) shortcutView
- .findViewById(R.id.keyboard_shortcuts_item_container);
shortcutItemsContainer.addView(shortcutKeyView);
}
- shortcutWrapper.addView(shortcutView);
+ shortcutContainer.addView(shortcutView);
}
-
- // TODO: merge container and wrapper into one xml file - wrapper is always a child of
- // container.
- LinearLayout shortcutsContainer = (LinearLayout) inflater.inflate(
- R.layout.keyboard_shortcuts_container, null);
- shortcutsContainer.addView(shortcutWrapper);
- keyboardShortcutsLayout.addView(shortcutsContainer);
+ keyboardShortcutsLayout.addView(shortcutContainer);
+ if (i < keyboardShortcutGroupsSize - 1) {
+ View separator = inflater.inflate(
+ R.layout.keyboard_shortcuts_category_separator, keyboardShortcutsLayout,
+ false);
+ keyboardShortcutsLayout.addView(separator);
+ }
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java
index a2586f1..bb03454 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java
@@ -304,8 +304,7 @@
public void onTuningChanged(String key, String newValue) {
switch (key) {
case KEY_DOCK_WINDOW_GESTURE:
- mDockWindowEnabled = (newValue == null) ||
- (Integer.parseInt(newValue) != 0);
+ mDockWindowEnabled = newValue != null && (Integer.parseInt(newValue) != 0);
break;
}
}
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 575eda7..f822bd5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -39,8 +39,6 @@
import android.view.ViewTreeObserver;
import android.view.WindowInsets;
import android.view.accessibility.AccessibilityEvent;
-import android.view.animation.Interpolator;
-import android.view.animation.PathInterpolator;
import android.widget.FrameLayout;
import android.widget.TextView;
@@ -212,10 +210,6 @@
}
};
- /** Interpolator to be used for animations that respond directly to a touch */
- private final Interpolator mTouchResponseInterpolator =
- new PathInterpolator(0.3f, 0f, 0.1f, 1f);
-
public NotificationPanelView(Context context, AttributeSet attrs) {
super(context, attrs);
setWillNotDraw(!DEBUG);
@@ -1447,7 +1441,7 @@
mScrollView.setBlockFlinging(true);
ValueAnimator animator = ValueAnimator.ofFloat(mQsExpansionHeight, target);
if (isClick) {
- animator.setInterpolator(mTouchResponseInterpolator);
+ animator.setInterpolator(Interpolators.TOUCH_RESPONSE);
animator.setDuration(368);
} else {
mFlingAnimationUtils.apply(animator, mQsExpansionHeight, target, vel);
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 07dc4fd..4dee51d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -118,7 +118,10 @@
import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.qs.QSPanel;
import com.android.systemui.recents.ScreenPinningRequest;
+import com.android.systemui.recents.events.EventBus;
+import com.android.systemui.recents.events.activity.UndockingTaskEvent;
import com.android.systemui.stackdivider.Divider;
+import com.android.systemui.stackdivider.WindowManagerProxy;
import com.android.systemui.statusbar.ActivatableNotificationView;
import com.android.systemui.statusbar.BackDropView;
import com.android.systemui.statusbar.BaseStatusBar;
@@ -1112,26 +1115,25 @@
@Override
public boolean onLongClick(View v) {
if (mRecents != null) {
- Point realSize = new Point();
- mContext.getSystemService(DisplayManager.class).getDisplay(Display.DEFAULT_DISPLAY)
- .getRealSize(realSize);
- Rect initialBounds;
-
- // Hack level over 9000: Make it one pixel smaller so activity manager doesn't
- // dismiss it immediately again. Remove once b/26777526 is fixed.
- if (mContext.getResources().getConfiguration().orientation
- == Configuration.ORIENTATION_LANDSCAPE) {
- initialBounds = new Rect(0, 0, realSize.x - 1, realSize.y);
+ int dockSide = WindowManagerProxy.getInstance().getDockSide();
+ if (dockSide == WindowManager.DOCKED_INVALID) {
+ Point realSize = new Point();
+ mContext.getSystemService(DisplayManager.class).getDisplay(Display.DEFAULT_DISPLAY)
+ .getRealSize(realSize);
+ Rect initialBounds= new Rect(0, 0, realSize.x, realSize.y);
+ boolean docked = mRecents.dockTopTask(NavigationBarGestureHelper.DRAG_MODE_NONE,
+ ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT,
+ initialBounds);
+ if (docked) {
+ MetricsLogger.action(mContext, MetricsEvent.ACTION_WINDOW_DOCK_LONGPRESS);
+ return true;
+ }
} else {
- initialBounds = new Rect(0, 0, realSize.x, realSize.y - 1);
- }
- boolean docked = mRecents.dockTopTask(NavigationBarGestureHelper.DRAG_MODE_NONE,
- ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT,
- initialBounds);
- if (docked) {
- MetricsLogger.action(mContext, MetricsEvent.ACTION_WINDOW_DOCK_LONGPRESS);
+ EventBus.getDefault().send(new UndockingTaskEvent());
+ MetricsLogger.action(mContext, MetricsEvent.ACTION_WINDOW_UNDOCK_LONGPRESS);
return true;
}
+
}
return false;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
index bc8c825..784f610 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
@@ -80,10 +80,6 @@
boolean showImeSwitcher) {
}
- @Override
- public void toggleRecentApps() {
- }
-
@Override // CommandQueue
public void setWindowState(int window, int state) {
}
diff --git a/proto/src/metrics_constants.proto b/proto/src/metrics_constants.proto
index 0e67a24..e1dd87f 100644
--- a/proto/src/metrics_constants.proto
+++ b/proto/src/metrics_constants.proto
@@ -348,5 +348,9 @@
// OS: 6.1
// GMS: 7.8.99
USER_CREDENTIALS = 285;
+
+ // Logged when the user undocks a previously docked window by long pressing recents while in
+ // docked mode.
+ ACTION_WINDOW_UNDOCK_LONGPRESS = 286;
}
}
diff --git a/services/core/java/com/android/server/DeviceIdleController.java b/services/core/java/com/android/server/DeviceIdleController.java
index 9bd79c9..423ef84 100644
--- a/services/core/java/com/android/server/DeviceIdleController.java
+++ b/services/core/java/com/android/server/DeviceIdleController.java
@@ -1649,6 +1649,7 @@
// Whoops, there is an upcoming alarm. We don't actually want to go idle.
if (mState != STATE_ACTIVE) {
becomeActiveLocked("alarm", Process.myUid());
+ becomeInactiveIfAppropriateLocked();
}
return;
}
diff --git a/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java b/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java
index 4f0d4d9..bef6f0a 100644
--- a/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java
+++ b/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java
@@ -62,7 +62,7 @@
static final boolean DEBUG_LRU = DEBUG_ALL || false;
static final boolean DEBUG_MU = DEBUG_ALL || false;
static final boolean DEBUG_OOM_ADJ = DEBUG_ALL || false;
- static final boolean DEBUG_PAUSE = DEBUG_ALL || false;
+ static final boolean DEBUG_PAUSE = DEBUG_ALL || true;
static final boolean DEBUG_POWER = DEBUG_ALL || false;
static final boolean DEBUG_POWER_QUICK = DEBUG_POWER || false;
static final boolean DEBUG_PROCESS_OBSERVERS = DEBUG_ALL || false;
@@ -77,7 +77,7 @@
static final boolean DEBUG_SERVICE = DEBUG_ALL || false;
static final boolean DEBUG_SERVICE_EXECUTING = DEBUG_ALL || false;
static final boolean DEBUG_STACK = DEBUG_ALL || false;
- static final boolean DEBUG_STATES = DEBUG_ALL_ACTIVITIES || false;
+ static final boolean DEBUG_STATES = DEBUG_ALL_ACTIVITIES || true;
static final boolean DEBUG_SWITCH = DEBUG_ALL || false;
static final boolean DEBUG_TASKS = DEBUG_ALL || false;
static final boolean DEBUG_THUMBNAILS = DEBUG_ALL || false;
@@ -85,7 +85,7 @@
static final boolean DEBUG_UID_OBSERVERS = DEBUG_ALL || false;
static final boolean DEBUG_URI_PERMISSION = DEBUG_ALL || false;
static final boolean DEBUG_USER_LEAVING = DEBUG_ALL || false;
- static final boolean DEBUG_VISIBILITY = DEBUG_ALL || false;
+ static final boolean DEBUG_VISIBILITY = DEBUG_ALL || true;
static final boolean DEBUG_VISIBLE_BEHIND = DEBUG_ALL_ACTIVITIES || false;
static final boolean DEBUG_USAGE_STATS = DEBUG_ALL || false;
static final boolean DEBUG_PERMISSIONS_REVIEW = DEBUG_ALL || false;
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 072249f..d646696 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -252,10 +252,12 @@
import static android.app.ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT;
import static android.app.ActivityManager.RESIZE_MODE_PRESERVE_WINDOW;
import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
+import static android.app.ActivityManager.StackId.FIRST_STATIC_STACK_ID;
import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.FULLSCREEN_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.HOME_STACK_ID;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
+import static android.app.ActivityManager.StackId.LAST_STATIC_STACK_ID;
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
import static android.content.pm.PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT;
import static android.content.pm.PackageManager.FEATURE_PICTURE_IN_PICTURE;
@@ -600,6 +602,8 @@
final AppErrors mAppErrors;
+ boolean mDoingSetFocusedActivity;
+
public boolean canShowErrorDialogs() {
return mShowDialogs && !mSleeping && !mShuttingDown;
}
@@ -2730,6 +2734,12 @@
}
if (DEBUG_FOCUS) Slog.d(TAG_FOCUS, "setFocusedActivityLocked: r=" + r);
+
+ final boolean wasDoingSetFocusedActivity = mDoingSetFocusedActivity;
+ if (wasDoingSetFocusedActivity) Slog.w(TAG,
+ "setFocusedActivityLocked: called recursively, r=" + r + ", reason=" + reason);
+ mDoingSetFocusedActivity = true;
+
final ActivityRecord last = mFocusedActivity;
mFocusedActivity = r;
if (r.task.isApplicationTask()) {
@@ -2781,6 +2791,12 @@
mLastFocusedUserId = mFocusedActivity.userId;
}
+ // Log a warning if the focused app is changed during the process. This could
+ // indicate a problem of the focus setting logic!
+ if (mFocusedActivity != r) Slog.w(TAG,
+ "setFocusedActivityLocked: r=" + r + " but focused to " + mFocusedActivity);
+ mDoingSetFocusedActivity = wasDoingSetFocusedActivity;
+
EventLogTags.writeAmFocusedActivity(
mFocusedActivity == null ? -1 : mFocusedActivity.userId,
mFocusedActivity == null ? "NULL" : mFocusedActivity.shortComponentName,
@@ -5337,7 +5353,8 @@
// We don't kill persistent processes.
continue;
}
- if (targetSdkVersion > 0 && app.info.targetSdkVersion < targetSdkVersion) {
+ if (targetSdkVersion > 0
+ && app.info.targetSdkVersion >= targetSdkVersion) {
continue;
}
if (app.removed) {
@@ -17631,6 +17648,22 @@
final long origId = Binder.clearCallingIdentity();
final ActivityStack stack = mStackSupervisor.getStack(fromStackId);
if (stack != null) {
+ if (fromStackId == DOCKED_STACK_ID) {
+
+ // We are moving all tasks from the docked stack to the fullscreen stack, which
+ // is dismissing the docked stack, so resize all other stacks to fullscreen here
+ // already so we don't end up with resize trashing.
+ for (int i = FIRST_STATIC_STACK_ID; i <= LAST_STATIC_STACK_ID; i++) {
+ if (StackId.isResizeableByDockedStack(i)) {
+ ActivityStack otherStack = mStackSupervisor.getStack(i);
+ if (otherStack != null) {
+ mStackSupervisor.resizeStackLocked(i,
+ null, null, null, PRESERVE_WINDOWS,
+ true /* allowResizeInDockedMode */);
+ }
+ }
+ }
+ }
final ArrayList<TaskRecord> tasks = stack.getAllTasks();
final int size = tasks.size();
if (onTop) {
@@ -17769,7 +17802,7 @@
if (values.getLocales().size() == 1) {
// This is an optimization to avoid the JNI call when the result of
// getFirstMatch() does not depend on the supported locales.
- locale = values.getLocales().getPrimary();
+ locale = values.getLocales().get(0);
} else {
if (mSupportedSystemLocales == null) {
mSupportedSystemLocales =
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 5a0c1c1..c352fc8 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -2168,7 +2168,9 @@
if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "Resume running: " + next);
// This activity is now becoming visible.
- mWindowManager.setAppVisibility(next.appToken, true);
+ if (!next.visible) {
+ mWindowManager.setAppVisibility(next.appToken, true);
+ }
// schedule launch ticks to collect information about slow apps.
next.startLaunchTickingLocked();
@@ -4304,6 +4306,12 @@
oldTaskOverride = record.task.extractOverrideConfig(record.configuration);
}
+ // Conversely, do the same when going the other direction.
+ if (Configuration.EMPTY.equals(taskConfig)
+ && !Configuration.EMPTY.equals(oldTaskOverride)) {
+ taskConfig = record.task.extractOverrideConfig(record.configuration);
+ }
+
// Determine what has changed. May be nothing, if this is a config
// that has come back from the app after going idle. In that case
// we just want to leave the official config object now in the
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 95bc95a..33112c6 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -583,7 +583,7 @@
}
final ActivityRecord r = topRunningActivityLocked();
- if (mService.mFocusedActivity != r) {
+ if (!mService.mDoingSetFocusedActivity && mService.mFocusedActivity != r) {
// The focus activity should always be the top activity in the focused stack.
// There will be chaos and anarchy if it isn't...
mService.setFocusedActivityLocked(r, reason + " setFocusStack");
@@ -1889,12 +1889,6 @@
private void resizeStackUncheckedLocked(ActivityStack stack, Rect bounds, Rect tempTaskBounds,
Rect tempTaskInsetBounds) {
- if (bounds != null && mWindowManager.isFullscreenBounds(stack.mStackId, bounds)) {
- // The bounds passed in corresponds to the fullscreen bounds which we normally
- // represent with null. Go ahead and set it to null so that all tasks configuration
- // can have the right fullscreen state.
- bounds = null;
- }
bounds = TaskRecord.validateBounds(bounds);
mTmpBounds.clear();
@@ -1913,7 +1907,8 @@
task.updateOverrideConfiguration(tempRect2);
} else {
task.updateOverrideConfiguration(
- tempTaskBounds != null ? tempTaskBounds : bounds);
+ tempTaskBounds != null ? tempTaskBounds : bounds,
+ tempTaskInsetBounds != null ? tempTaskInsetBounds : bounds);
}
}
@@ -2213,9 +2208,9 @@
// Temporarily disable resizeablility of task we are moving. We don't want it to be resized
// if a docked stack is created below which will lead to the stack we are moving from and
// its resizeable tasks being resized.
- task.mResizeMode = RESIZE_MODE_UNRESIZEABLE;
+ task.mTemporarilyUnresizable = true;
final ActivityStack stack = getStack(stackId, CREATE_IF_NEEDED, toTop);
- task.mResizeMode = resizeMode;
+ task.mTemporarilyUnresizable = false;
mWindowManager.moveTaskToStack(task.taskId, stack.mStackId, toTop);
stack.addTask(task, toTop, reason);
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index a7d948c..703dfca 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -16,37 +16,7 @@
package com.android.server.am;
-import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
-import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
-import static android.app.ActivityManager.StackId.FULLSCREEN_WORKSPACE_STACK_ID;
-import static android.app.ActivityManager.StackId.HOME_STACK_ID;
-import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
-import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
-import static android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
-import static android.content.Intent.FLAG_ACTIVITY_RETAIN_IN_RECENTS;
-import static android.content.pm.ActivityInfo.RESIZE_MODE_CROP_WINDOWS;
-import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE;
-import static android.content.pm.ActivityInfo.RESIZE_MODE_UNRESIZEABLE;
-import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_ALWAYS;
-import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_DEFAULT;
-import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED;
-import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_NEVER;
-import static android.content.pm.ApplicationInfo.PRIVATE_FLAG_PRIVILEGED;
-import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_ADD_REMOVE;
-import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_LOCKTASK;
-import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_RECENTS;
-import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_TASKS;
-import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_ADD_REMOVE;
-import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_LOCKTASK;
-import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_RECENTS;
-import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_TASKS;
-import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM;
-import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME;
-import static com.android.server.am.ActivityManagerService.LOCK_SCREEN_SHOWN;
-import static com.android.server.am.ActivityRecord.APPLICATION_ACTIVITY_TYPE;
-import static com.android.server.am.ActivityRecord.HOME_ACTIVITY_TYPE;
-import static com.android.server.am.ActivityRecord.RECENTS_ACTIVITY_TYPE;
-
+import android.annotation.Nullable;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManager.StackId;
@@ -55,6 +25,7 @@
import android.app.ActivityManager.TaskThumbnailInfo;
import android.app.ActivityOptions;
import android.app.AppGlobals;
+import android.app.IActivityManager;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.ActivityInfo;
@@ -86,6 +57,37 @@
import java.util.ArrayList;
import java.util.Objects;
+import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
+import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
+import static android.app.ActivityManager.StackId.FULLSCREEN_WORKSPACE_STACK_ID;
+import static android.app.ActivityManager.StackId.HOME_STACK_ID;
+import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
+import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
+import static android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
+import static android.content.Intent.FLAG_ACTIVITY_RETAIN_IN_RECENTS;
+import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_ALWAYS;
+import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_DEFAULT;
+import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED;
+import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_NEVER;
+import static android.content.pm.ActivityInfo.RESIZE_MODE_CROP_WINDOWS;
+import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE;
+import static android.content.pm.ActivityInfo.RESIZE_MODE_UNRESIZEABLE;
+import static android.content.pm.ApplicationInfo.PRIVATE_FLAG_PRIVILEGED;
+import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_ADD_REMOVE;
+import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_LOCKTASK;
+import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_RECENTS;
+import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_TASKS;
+import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_ADD_REMOVE;
+import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_LOCKTASK;
+import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_RECENTS;
+import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_TASKS;
+import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM;
+import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME;
+import static com.android.server.am.ActivityManagerService.LOCK_SCREEN_SHOWN;
+import static com.android.server.am.ActivityRecord.APPLICATION_ACTIVITY_TYPE;
+import static com.android.server.am.ActivityRecord.HOME_ACTIVITY_TYPE;
+import static com.android.server.am.ActivityRecord.RECENTS_ACTIVITY_TYPE;
+
final class TaskRecord {
private static final String TAG = TAG_WITH_CLASS_NAME ? "TaskRecord" : TAG_AM;
private static final String TAG_ADD_REMOVE = TAG + POSTFIX_ADD_REMOVE;
@@ -160,6 +162,8 @@
int mResizeMode; // The resize mode of this task and its activities.
// Based on the {@link ActivityInfo#resizeMode} of the root activity.
+ boolean mTemporarilyUnresizable; // Separate flag from mResizeMode used to suppress resize
+ // changes on a temporary basis.
int mLockTaskMode; // Which tasklock mode to launch this task in. One of
// ActivityManager.LOCK_TASK_LAUNCH_MODE_*
private boolean mPrivileged; // The root activity application of this task holds
@@ -238,6 +242,9 @@
// Bounds of the Task. null for fullscreen tasks.
Rect mBounds = null;
+ private final Rect mTmpRect = new Rect();
+ private final Rect mTmpRect2 = new Rect();
+
// Last non-fullscreen bounds the task was launched in or resized to.
// The information is persisted and used to determine the appropriate stack to launch the
// task into on restore.
@@ -934,7 +941,7 @@
boolean isResizeable() {
return !isHomeTask() && (mService.mForceResizableActivities
- || ActivityInfo.isResizeableMode(mResizeMode));
+ || ActivityInfo.isResizeableMode(mResizeMode)) && !mTemporarilyUnresizable;
}
boolean inCropWindowsResizeMode() {
@@ -1291,9 +1298,22 @@
/**
* Update task's override configuration based on the bounds.
+ * @param bounds The bounds of the task.
* @return Update configuration or null if there is no change.
*/
Configuration updateOverrideConfiguration(Rect bounds) {
+ return updateOverrideConfiguration(bounds, null /* insetBounds */);
+ }
+
+ /**
+ * Update task's override configuration based on the bounds.
+ * @param bounds The bounds of the task.
+ * @param insetBounds The bounds used to calculate the system insets, which is used here to
+ * subtract the navigation bar/status bar size from the screen size reported
+ * to the application. See {@link IActivityManager#resizeDockedStack}.
+ * @return Update configuration or null if there is no change.
+ */
+ Configuration updateOverrideConfiguration(Rect bounds, @Nullable Rect insetBounds) {
if (Objects.equals(mBounds, bounds)) {
return null;
}
@@ -1316,7 +1336,12 @@
if (stack == null || StackId.persistTaskBounds(stack.mStackId)) {
mLastNonFullscreenBounds = mBounds;
}
- mOverrideConfig = calculateOverrideConfig(mBounds);
+
+ // Stable insets need to be subtracted because we also subtract it in the fullscreen
+ // configuration.
+ mTmpRect.set(bounds);
+ subtractStableInsets(mTmpRect, insetBounds != null ? insetBounds : mTmpRect);
+ mOverrideConfig = calculateOverrideConfig(mTmpRect);
}
if (mFullscreen != oldFullscreen) {
@@ -1326,6 +1351,16 @@
return !mOverrideConfig.equals(oldConfig) ? mOverrideConfig : null;
}
+ private void subtractStableInsets(Rect inOutBounds, Rect inInsetBounds) {
+ mTmpRect2.set(inInsetBounds);
+ mService.mWindowManager.subtractStableInsets(mTmpRect2);
+ int leftInset = mTmpRect2.left - inInsetBounds.left;
+ int topInset = mTmpRect2.top - inInsetBounds.top;
+ int rightInset = inInsetBounds.right - mTmpRect2.right;
+ int bottomInset = inInsetBounds.bottom - mTmpRect2.bottom;
+ inOutBounds.inset(leftInset, topInset, rightInset, bottomInset);
+ }
+
Configuration calculateOverrideConfig(Rect bounds) {
final Configuration serviceConfig = mService.mConfiguration;
final Configuration config = new Configuration(Configuration.EMPTY);
@@ -1341,8 +1376,9 @@
? Configuration.ORIENTATION_PORTRAIT
: Configuration.ORIENTATION_LANDSCAPE;
final int sl = Configuration.resetScreenLayout(serviceConfig.screenLayout);
- config.screenLayout = Configuration.reduceScreenLayout(
- sl, config.screenWidthDp, config.screenHeightDp);
+ int longSize = Math.max(config.screenWidthDp, config.screenHeightDp);
+ int shortSize = Math.min(config.screenWidthDp, config.screenHeightDp);
+ config.screenLayout = Configuration.reduceScreenLayout(sl, longSize, shortSize);
return config;
}
diff --git a/services/core/java/com/android/server/job/controllers/JobStatus.java b/services/core/java/com/android/server/job/controllers/JobStatus.java
index be55799..e749433 100644
--- a/services/core/java/com/android/server/job/controllers/JobStatus.java
+++ b/services/core/java/com/android/server/job/controllers/JobStatus.java
@@ -349,9 +349,9 @@
pw.print(prefix); UserHandle.formatUid(pw, uId);
pw.print(" tag="); pw.println(tag);
pw.print(prefix);
- pw.print("Source: uid="); UserHandle.formatUid(pw, sourceUid);
- pw.print(" user="); pw.print(sourceUserId);
- pw.print(" pkg="); pw.println(sourcePackageName);
+ pw.print("Source: uid="); UserHandle.formatUid(pw, getSourceUid());
+ pw.print(" user="); pw.print(getSourceUserId());
+ pw.print(" pkg="); pw.println(getSourcePackageName());
pw.print(prefix); pw.println("JobInfo:");
pw.print(prefix); pw.print(" Service: ");
pw.println(job.getService().flattenToShortString());
diff --git a/services/core/java/com/android/server/pm/PackageDexOptimizer.java b/services/core/java/com/android/server/pm/PackageDexOptimizer.java
index 64af213..a3af561 100644
--- a/services/core/java/com/android/server/pm/PackageDexOptimizer.java
+++ b/services/core/java/com/android/server/pm/PackageDexOptimizer.java
@@ -176,8 +176,14 @@
dexoptNeeded = adjustDexoptNeeded(dexoptNeeded);
if (dexoptNeeded == DexFile.NO_DEXOPT_NEEDED) {
- // No dexopt needed and we don't use profiles. Nothing to do.
- continue;
+ if (useProfiles) {
+ // Profiles may trigger re-compilation. The final decision is taken in
+ // installd.
+ dexoptNeeded = DexFile.DEX2OAT_NEEDED;
+ } else {
+ // No dexopt needed and we don't use profiles. Nothing to do.
+ continue;
+ }
}
final String dexoptType;
String oatDir = null;
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 43b82e9..a92cc31 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -6877,7 +6877,12 @@
final boolean dockedStackVisible = mWindowManagerInternal.isStackVisible(DOCKED_STACK_ID);
final boolean freeformStackVisible =
mWindowManagerInternal.isStackVisible(FREEFORM_WORKSPACE_STACK_ID);
- final boolean forceShowSystemBars = dockedStackVisible || freeformStackVisible;
+ final boolean resizing = mWindowManagerInternal.isDockedDividerResizing();
+
+ // We need to force system bars when the docked stack is visible, when the freeform stack
+ // is visible but also when we are resizing for the transitions when docked stack
+ // visibility changes.
+ final boolean forceShowSystemBars = dockedStackVisible || freeformStackVisible || resizing;
final boolean forceOpaqueSystemBars = forceShowSystemBars && !mForceStatusBarFromKeyguard;
// apply translucent bar vis flags
diff --git a/services/core/java/com/android/server/tv/TvInputManagerService.java b/services/core/java/com/android/server/tv/TvInputManagerService.java
index b065e85..342c078 100644
--- a/services/core/java/com/android/server/tv/TvInputManagerService.java
+++ b/services/core/java/com/android/server/tv/TvInputManagerService.java
@@ -584,14 +584,14 @@
for (IBinder sessionToken : serviceState.sessionTokens) {
SessionState sessionState = userState.sessionStateMap.get(sessionToken);
if (sessionState.session == null && (inputId == null
- || sessionState.info.getId().equals(inputId))) {
+ || sessionState.inputId.equals(inputId))) {
sessionsToAbort.add(sessionState);
}
}
for (SessionState sessionState : sessionsToAbort) {
removeSessionStateLocked(sessionState.sessionToken, sessionState.userId);
sendSessionTokenToClientLocked(sessionState.client,
- sessionState.info.getId(), null, null, sessionState.seq);
+ sessionState.inputId, null, null, sessionState.seq);
}
updateServiceConnectionLocked(serviceState.component, userId);
}
@@ -601,7 +601,7 @@
UserState userState = getOrCreateUserStateLocked(userId);
SessionState sessionState = userState.sessionStateMap.get(sessionToken);
if (DEBUG) {
- Slog.d(TAG, "createSessionInternalLocked(inputId=" + sessionState.info.getId() + ")");
+ Slog.d(TAG, "createSessionInternalLocked(inputId=" + sessionState.inputId + ")");
}
InputChannel[] channels = InputChannel.openInputChannelPair(sessionToken.toString());
@@ -611,14 +611,14 @@
// Create a session. When failed, send a null token immediately.
try {
if (sessionState.isRecordingSession) {
- service.createRecordingSession(callback, sessionState.info.getId());
+ service.createRecordingSession(callback, sessionState.inputId);
} else {
- service.createSession(channels[1], callback, sessionState.info.getId());
+ service.createSession(channels[1], callback, sessionState.inputId);
}
} catch (RemoteException e) {
Slog.e(TAG, "error in createSession", e);
removeSessionStateLocked(sessionToken, userId);
- sendSessionTokenToClientLocked(sessionState.client, sessionState.info.getId(), null,
+ sendSessionTokenToClientLocked(sessionState.client, sessionState.inputId, null,
null, sessionState.seq);
}
channels[1].dispose();
@@ -684,14 +684,11 @@
}
}
- TvInputInfo info = sessionState.info;
- if (info != null) {
- ServiceState serviceState = userState.serviceStateMap.get(info.getComponent());
- if (serviceState != null) {
- serviceState.sessionTokens.remove(sessionToken);
- }
+ ServiceState serviceState = userState.serviceStateMap.get(sessionState.componentName);
+ if (serviceState != null) {
+ serviceState.sessionTokens.remove(sessionToken);
}
- updateServiceConnectionLocked(sessionState.info.getComponent(), userId);
+ updateServiceConnectionLocked(sessionState.componentName, userId);
// Log the end of watch.
SomeArgs args = SomeArgs.obtain();
@@ -707,7 +704,7 @@
sessionState = getSessionStateLocked(sessionState.hardwareSessionToken,
Process.SYSTEM_UID, userId);
}
- ServiceState serviceState = getServiceStateLocked(sessionState.info.getComponent(), userId);
+ ServiceState serviceState = getServiceStateLocked(sessionState.componentName, userId);
if (!serviceState.isHardware) {
return;
}
@@ -1091,8 +1088,9 @@
// Create a new session token and a session state.
IBinder sessionToken = new Binder();
- SessionState sessionState = new SessionState(sessionToken, info,
- isRecordingSession, client, seq, callingUid, resolvedUserId);
+ SessionState sessionState = new SessionState(sessionToken, info.getId(),
+ info.getComponent(), isRecordingSession, client, seq, callingUid,
+ resolvedUserId);
// Add them to the global session state map of the current user.
userState.sessionStateMap.put(sessionToken, sessionState);
@@ -1273,7 +1271,7 @@
// Log the start of watch.
SomeArgs args = SomeArgs.obtain();
- args.arg1 = sessionState.info.getComponent().getPackageName();
+ args.arg1 = sessionState.componentName.getPackageName();
args.arg2 = System.currentTimeMillis();
args.arg3 = ContentUris.parseId(channelUri);
args.arg4 = params;
@@ -1779,10 +1777,10 @@
return false;
}
for (SessionState sessionState : userState.sessionStateMap.values()) {
- if (sessionState.info.getId().equals(inputId)
+ if (sessionState.inputId.equals(inputId)
&& sessionState.hardwareSessionToken != null) {
hardwareInputId = userState.sessionStateMap.get(
- sessionState.hardwareSessionToken).info.getId();
+ sessionState.hardwareSessionToken).inputId;
break;
}
}
@@ -1918,7 +1916,7 @@
pw.println(entry.getKey() + ": " + session);
pw.increaseIndent();
- pw.println("info: " + session.info);
+ pw.println("inputId: " + session.inputId);
pw.println("client: " + session.client);
pw.println("seq: " + session.seq);
pw.println("callingUid: " + session.callingUid);
@@ -2046,7 +2044,8 @@
}
private final class SessionState implements IBinder.DeathRecipient {
- private final TvInputInfo info;
+ private final String inputId;
+ private final ComponentName componentName;
private final boolean isRecordingSession;
private final ITvInputClient client;
private final int seq;
@@ -2058,10 +2057,12 @@
// Not null if this session represents an external device connected to a hardware TV input.
private IBinder hardwareSessionToken;
- private SessionState(IBinder sessionToken, TvInputInfo info, boolean isRecordingSession,
- ITvInputClient client, int seq, int callingUid, int userId) {
+ private SessionState(IBinder sessionToken, String inputId, ComponentName componentName,
+ boolean isRecordingSession, ITvInputClient client, int seq, int callingUid,
+ int userId) {
this.sessionToken = sessionToken;
- this.info = info;
+ this.inputId = inputId;
+ this.componentName = componentName;
this.isRecordingSession = isRecordingSession;
this.client = client;
this.seq = seq;
@@ -2274,19 +2275,19 @@
@Override
public void onSessionCreated(ITvInputSession session, IBinder hardwareSessionToken) {
if (DEBUG) {
- Slog.d(TAG, "onSessionCreated(inputId=" + mSessionState.info.getId() + ")");
+ Slog.d(TAG, "onSessionCreated(inputId=" + mSessionState.inputId + ")");
}
synchronized (mLock) {
mSessionState.session = session;
mSessionState.hardwareSessionToken = hardwareSessionToken;
if (session != null && addSessionTokenToClientStateLocked(session)) {
sendSessionTokenToClientLocked(mSessionState.client,
- mSessionState.info.getId(), mSessionState.sessionToken, mChannels[0],
+ mSessionState.inputId, mSessionState.sessionToken, mChannels[0],
mSessionState.seq);
} else {
removeSessionStateLocked(mSessionState.sessionToken, mSessionState.userId);
sendSessionTokenToClientLocked(mSessionState.client,
- mSessionState.info.getId(), null, null, mSessionState.seq);
+ mSessionState.inputId, null, null, mSessionState.seq);
}
mChannels[0].dispose();
}
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index be1b85c..a06d3fc 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -289,11 +289,9 @@
if (displayContent != null) {
displayContent.getLogicalDisplayRect(mTmpRect);
rotation = displayContent.getDisplayInfo().rotation;
- if (bounds == null) {
+ mFullscreen = bounds == null;
+ if (mFullscreen) {
bounds = mTmpRect;
- mFullscreen = true;
- } else {
- mFullscreen = mTmpRect.equals(bounds);
}
}
diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java
index ecc1364..40ca1c5 100644
--- a/services/core/java/com/android/server/wm/TaskStack.java
+++ b/services/core/java/com/android/server/wm/TaskStack.java
@@ -255,11 +255,9 @@
if (mDisplayContent != null) {
mDisplayContent.getLogicalDisplayRect(mTmpRect);
rotation = mDisplayContent.getDisplayInfo().rotation;
- if (bounds == null) {
+ mFullscreen = bounds == null;
+ if (mFullscreen) {
bounds = mTmpRect;
- mFullscreen = true;
- } else {
- mFullscreen = mTmpRect.equals(bounds);
}
}
@@ -587,7 +585,8 @@
}
void getStackDockedModeBoundsLocked(Rect outBounds, boolean ignoreVisibility) {
- if (!StackId.isResizeableByDockedStack(mStackId) || mDisplayContent == null) {
+ if ((mStackId != DOCKED_STACK_ID && !StackId.isResizeableByDockedStack(mStackId))
+ || mDisplayContent == null) {
outBounds.set(mBounds);
return;
}
@@ -616,8 +615,7 @@
mDisplayContent.getLogicalDisplayRect(mTmpRect);
dockedStack.getRawBounds(mTmpRect2);
- final boolean dockedOnTopOrLeft = dockedSide == DOCKED_TOP
- || dockedSide == DOCKED_LEFT;
+ final boolean dockedOnTopOrLeft = dockedSide == DOCKED_TOP || dockedSide == DOCKED_LEFT;
getStackDockedModeBounds(mTmpRect, outBounds, mStackId, mTmpRect2,
mDisplayContent.mDividerControllerLocked.getContentWidth(), dockedOnTopOrLeft);
@@ -722,6 +720,19 @@
}
}
+ void resetDockedStackToMiddle() {
+ if (mStackId != DOCKED_STACK_ID) {
+ throw new IllegalStateException("Not a docked stack=" + this);
+ }
+
+ mService.mDockedStackCreateBounds = null;
+
+ final Rect bounds = new Rect();
+ getStackDockedModeBoundsLocked(bounds, true /*ignoreVisibility*/);
+ mService.mH.obtainMessage(RESIZE_STACK, DOCKED_STACK_ID,
+ 1 /*allowResizeInDockedMode*/, bounds).sendToTarget();
+ }
+
void detachDisplay() {
EventLog.writeEvent(EventLogTags.WM_STACK_REMOVED, mStackId);
@@ -865,14 +876,14 @@
final int orientation = mService.mCurConfiguration.orientation;
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
// Portrait mode, docked either at the top or the bottom.
- if (bounds.top - mTmpRect.top < mTmpRect.bottom - bounds.bottom) {
+ if (bounds.top - mTmpRect.top <= mTmpRect.bottom - bounds.bottom) {
return DOCKED_TOP;
} else {
return DOCKED_BOTTOM;
}
} else if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
// Landscape mode, docked either on the left or on the right.
- if (bounds.left - mTmpRect.left < mTmpRect.right - bounds.right) {
+ if (bounds.left - mTmpRect.left <= mTmpRect.right - bounds.right) {
return DOCKED_LEFT;
} else {
return DOCKED_RIGHT;
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index a26430e..ae6c89a 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -464,6 +464,8 @@
EmulatorDisplayOverlay mEmulatorDisplayOverlay;
final float[] mTmpFloats = new float[9];
+ final Rect mTmpRect = new Rect();
+ final Rect mTmpRect2 = new Rect();
boolean mDisplayReady;
boolean mSafeMode;
@@ -4845,17 +4847,6 @@
}
}
- /** Returns true if the input bounds corresponds to the fullscreen bounds the stack is on. */
- public boolean isFullscreenBounds(int stackId, Rect bounds) {
- synchronized (mWindowMap) {
- final TaskStack stack = mStackIdToStack.get(stackId);
- if (stack == null || bounds == null) {
- return true;
- }
- return stack.isFullscreenBounds(bounds);
- }
- }
-
/**
* Re-sizes a stack and its containing tasks.
* @param stackId Id of stack to resize.
@@ -5373,8 +5364,18 @@
mWindowPlacerLocked.performSurfacePlacement();
// Notify whether the docked stack exists for the current user
- getDefaultDisplayContentLocked().mDividerControllerLocked
+ final DisplayContent displayContent = getDefaultDisplayContentLocked();
+ displayContent.mDividerControllerLocked
.notifyDockedStackExistsChanged(hasDockedTasksForUser(newUserId));
+
+ // If the display is already prepared, update the density.
+ // Otherwise, we'll update it when it's prepared.
+ if (mDisplayReady) {
+ final int forcedDensity = getForcedDisplayDensityForUserLocked(newUserId);
+ final int targetDensity = forcedDensity != 0 ? forcedDensity
+ : displayContent.mInitialDisplayDensity;
+ setForcedDisplayDensityLocked(displayContent, targetDensity);
+ }
}
}
@@ -8370,21 +8371,9 @@
}
// Display density.
- String densityStr = Settings.Global.getString(mContext.getContentResolver(),
- Settings.Global.DISPLAY_DENSITY_FORCED);
- if (densityStr == null || densityStr.length() == 0) {
- densityStr = SystemProperties.get(DENSITY_OVERRIDE, null);
- }
- if (densityStr != null && densityStr.length() > 0) {
- int density;
- try {
- density = Integer.parseInt(densityStr);
- if (displayContent.mBaseDisplayDensity != density) {
- Slog.i(TAG_WM, "FORCED DISPLAY DENSITY: " + density);
- displayContent.mBaseDisplayDensity = density;
- }
- } catch (NumberFormatException ex) {
- }
+ final int density = getForcedDisplayDensityForUserLocked(mCurrentUserId);
+ if (density != 0) {
+ displayContent.mBaseDisplayDensity = density;
}
// Display scaling mode.
@@ -8470,8 +8459,9 @@
final DisplayContent displayContent = getDisplayContentLocked(displayId);
if (displayContent != null) {
setForcedDisplayDensityLocked(displayContent, density);
- Settings.Global.putString(mContext.getContentResolver(),
- Settings.Global.DISPLAY_DENSITY_FORCED, Integer.toString(density));
+ Settings.Secure.putStringForUser(mContext.getContentResolver(),
+ Settings.Secure.DISPLAY_DENSITY_FORCED,
+ Integer.toString(density), mCurrentUserId);
}
}
} finally {
@@ -8479,13 +8469,6 @@
}
}
- // displayContent must not be null
- private void setForcedDisplayDensityLocked(DisplayContent displayContent, int density) {
- Slog.i(TAG_WM, "Using new display density: " + density);
- displayContent.mBaseDisplayDensity = density;
- reconfigureDisplayLocked(displayContent);
- }
-
@Override
public void clearForcedDisplayDensity(int displayId) {
if (mContext.checkCallingOrSelfPermission(
@@ -8504,8 +8487,8 @@
if (displayContent != null) {
setForcedDisplayDensityLocked(displayContent,
displayContent.mInitialDisplayDensity);
- Settings.Global.putString(mContext.getContentResolver(),
- Settings.Global.DISPLAY_DENSITY_FORCED, "");
+ Settings.Secure.putStringForUser(mContext.getContentResolver(),
+ Settings.Secure.DISPLAY_DENSITY_FORCED, "", mCurrentUserId);
}
}
} finally {
@@ -8513,6 +8496,38 @@
}
}
+ /**
+ * @param userId the ID of the user
+ * @return the forced display density for the specified user, if set, or
+ * {@code 0} if not set
+ */
+ private int getForcedDisplayDensityForUserLocked(int userId) {
+ String densityStr = Settings.Secure.getStringForUser(mContext.getContentResolver(),
+ Settings.Secure.DISPLAY_DENSITY_FORCED, userId);
+ if (densityStr == null || densityStr.length() == 0) {
+ densityStr = SystemProperties.get(DENSITY_OVERRIDE, null);
+ }
+ if (densityStr != null && densityStr.length() > 0) {
+ try {
+ return Integer.parseInt(densityStr);
+ } catch (NumberFormatException ex) {
+ }
+ }
+ return 0;
+ }
+
+ /**
+ * Forces the given display to the use the specified density.
+ *
+ * @param displayContent the display to modify
+ * @param density the density in DPI to use
+ */
+ private void setForcedDisplayDensityLocked(@NonNull DisplayContent displayContent,
+ int density) {
+ displayContent.mBaseDisplayDensity = density;
+ reconfigureDisplayLocked(displayContent);
+ }
+
// displayContent must not be null
private void reconfigureDisplayLocked(DisplayContent displayContent) {
// TODO: Multidisplay: for now only use with default display.
@@ -10394,8 +10409,28 @@
@Override
public void getStableInsets(Rect outInsets) throws RemoteException {
synchronized (mWindowMap) {
+ getStableInsetsLocked(outInsets);
+ }
+ }
+
+ private void getStableInsetsLocked(Rect outInsets) {
+ final DisplayInfo di = getDefaultDisplayInfoLocked();
+ mPolicy.getStableInsetsLw(di.rotation, di.logicalWidth, di.logicalHeight, outInsets);
+ }
+
+ /**
+ * Intersects the specified {@code inOutBounds} with the display frame that excludes the stable
+ * inset areas.
+ *
+ * @param inOutBounds The inOutBounds to subtract the stable inset areas from.
+ */
+ public void subtractStableInsets(Rect inOutBounds) {
+ synchronized (mWindowMap) {
+ getStableInsetsLocked(mTmpRect2);
final DisplayInfo di = getDefaultDisplayInfoLocked();
- mPolicy.getStableInsetsLw(di.rotation, di.logicalWidth, di.logicalHeight, outInsets);
+ mTmpRect.set(0, 0, di.logicalWidth, di.logicalHeight);
+ mTmpRect.inset(mTmpRect2);
+ inOutBounds.intersect(mTmpRect);
}
}
@@ -10599,5 +10634,12 @@
return WindowManagerService.this.isStackVisibleLocked(stackId);
}
}
+
+ @Override
+ public boolean isDockedDividerResizing() {
+ synchronized (mWindowMap) {
+ return getDefaultDisplayContentLocked().getDockedDividerController().isResizing();
+ }
+ }
}
}
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 465c7e0..2f916d9 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -16,8 +16,6 @@
package com.android.server.wm;
-import com.android.server.input.InputWindowHandle;
-
import android.app.ActivityManager;
import android.app.AppOpsManager;
import android.content.Context;
@@ -53,10 +51,13 @@
import android.view.WindowManager;
import android.view.WindowManagerPolicy;
+import com.android.server.input.InputWindowHandle;
+
import java.io.PrintWriter;
import java.util.ArrayList;
import static android.app.ActivityManager.StackId;
+import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_CONTENT;
@@ -75,8 +76,8 @@
import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW;
import static android.view.WindowManager.LayoutParams.MATCH_PARENT;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
-import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH;
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST;
@@ -1608,6 +1609,14 @@
win.mAppToken.appDied = true;
}
mService.removeWindowLocked(win);
+ if (win.mAttrs.type == TYPE_DOCK_DIVIDER) {
+ // The owner of the docked divider died :( We reset the docked stack,
+ // just in case they have the divider at an unstable position.
+ final TaskStack stack = mService.mStackIdToStack.get(DOCKED_STACK_ID);
+ if (stack != null) {
+ stack.resetDockedStackToMiddle();
+ }
+ }
} else if (mHasSurface) {
Slog.e(TAG, "!!! LEAK !!! Window removed but surface still valid.");
mService.removeWindowLocked(WindowState.this);
@@ -2133,7 +2142,8 @@
// background.
return (mDisplayContent.mDividerControllerLocked.isResizing()
|| mAppToken != null && !mAppToken.mFrozenBounds.isEmpty()) &&
- !task.inFreeformWorkspace() && !task.isFullscreen();
+ !task.inFreeformWorkspace();
+
}
void setDragResizing() {
@@ -2327,6 +2337,12 @@
if (mDrawLock != null) {
pw.print(prefix); pw.println("mDrawLock=" + mDrawLock);
}
+ if (isDragResizing()) {
+ pw.print(prefix); pw.println("isDragResizing=" + isDragResizing());
+ }
+ if (computeDragResizing()) {
+ pw.print(prefix); pw.println("computeDragResizing=" + computeDragResizing());
+ }
}
String makeInputChannelName() {
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index b64db57..0cf9328 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -496,6 +496,7 @@
boolean disableNonCoreServices = SystemProperties.getBoolean("config.disable_noncore", false);
boolean disableNetwork = SystemProperties.getBoolean("config.disable_network", false);
boolean disableNetworkTime = SystemProperties.getBoolean("config.disable_networktime", false);
+ boolean disableRtt = SystemProperties.getBoolean("config.disable_rtt", false);
boolean isEmulator = SystemProperties.get("ro.kernel.qemu").equals("1");
try {
@@ -788,7 +789,9 @@
mSystemServiceManager.startService(
"com.android.server.wifi.WifiScanningService");
- mSystemServiceManager.startService("com.android.server.wifi.RttService");
+ if (!disableRtt) {
+ mSystemServiceManager.startService("com.android.server.wifi.RttService");
+ }
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_ETHERNET) ||
mPackageManager.hasSystemFeature(PackageManager.FEATURE_USB_HOST)) {
@@ -1088,7 +1091,9 @@
mSystemServiceManager.startService(TrustManagerService.class);
- mSystemServiceManager.startService(FingerprintService.class);
+ if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
+ mSystemServiceManager.startService(FingerprintService.class);
+ }
traceBeginAndSlog("StartBackgroundDexOptService");
try {
diff --git a/services/tests/servicestests/Android.mk b/services/tests/servicestests/Android.mk
index 25cb64c..7d7be07 100644
--- a/services/tests/servicestests/Android.mk
+++ b/services/tests/servicestests/Android.mk
@@ -26,7 +26,9 @@
LOCAL_CERTIFICATE := platform
-LOCAL_JNI_SHARED_LIBRARIES := libapfjni
+LOCAL_JNI_SHARED_LIBRARIES := \
+ libapfjni \
+ libnativehelper
include $(BUILD_PACKAGE)
diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/DpmTestBase.java b/services/tests/servicestests/src/com/android/server/devicepolicy/DpmTestBase.java
index 3dc1a9a..53ca45d 100644
--- a/services/tests/servicestests/src/com/android/server/devicepolicy/DpmTestBase.java
+++ b/services/tests/servicestests/src/com/android/server/devicepolicy/DpmTestBase.java
@@ -29,6 +29,7 @@
import java.io.File;
import java.util.List;
+import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doReturn;
@@ -135,8 +136,7 @@
doReturn(realResolveInfo).when(mMockContext.packageManager).queryBroadcastReceiversAsUser(
MockUtils.checkIntentComponent(admin),
- eq(PackageManager.GET_META_DATA
- | PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS),
+ anyInt(),
eq(UserHandle.getUserId(packageUid)));
// Set up getPackageInfo().
diff --git a/tests/HwAccelerationTest/AndroidManifest.xml b/tests/HwAccelerationTest/AndroidManifest.xml
index b028ce6..de7b9c2 100644
--- a/tests/HwAccelerationTest/AndroidManifest.xml
+++ b/tests/HwAccelerationTest/AndroidManifest.xml
@@ -356,6 +356,15 @@
</activity>
<activity
+ android:name="MovingSurfaceViewActivity"
+ android:label="SurfaceView/Animated Movement">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.android.test.hwui.TEST" />
+ </intent-filter>
+ </activity>
+
+ <activity
android:name="GLTextureViewActivity"
android:label="TextureView/OpenGL">
<intent-filter>
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/MovingSurfaceViewActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/MovingSurfaceViewActivity.java
new file mode 100644
index 0000000..cd15ef1
--- /dev/null
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/MovingSurfaceViewActivity.java
@@ -0,0 +1,125 @@
+/*
+ * 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.test.hwui;
+
+import android.animation.ObjectAnimator;
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.Canvas;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.SurfaceHolder;
+import android.view.SurfaceHolder.Callback;
+import android.view.SurfaceView;
+import android.view.View;
+import android.view.animation.LinearInterpolator;
+import android.widget.FrameLayout;
+
+public class MovingSurfaceViewActivity extends Activity implements Callback {
+ static final String TAG = "MovingSurfaceView";
+ SurfaceView mSurfaceView;
+ ObjectAnimator mAnimator;
+
+ class MySurfaceView extends SurfaceView {
+ boolean mSlowToggled;
+
+ public MySurfaceView(Context context) {
+ super(context);
+ setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mSlowToggled = !mSlowToggled;
+ Log.d(TAG, "SLOW MODE: " + mSlowToggled);
+ invalidate();
+ }
+ });
+ setWillNotDraw(false);
+ }
+
+ @Override
+ public void draw(Canvas canvas) {
+ super.draw(canvas);
+ if (mSlowToggled) {
+ try {
+ Thread.sleep(16);
+ } catch (InterruptedException e) {}
+ }
+ }
+
+ public void setMyTranslationY(float ty) {
+ setTranslationY(ty);
+ if (mSlowToggled) {
+ invalidate();
+ }
+ }
+
+ public float getMyTranslationY() {
+ return getTranslationY();
+ }
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ FrameLayout content = new FrameLayout(this);
+
+ mSurfaceView = new MySurfaceView(this);
+ mSurfaceView.getHolder().addCallback(this);
+
+ final float density = getResources().getDisplayMetrics().density;
+ int size = (int) (200 * density);
+
+ content.addView(mSurfaceView, new FrameLayout.LayoutParams(
+ size, size, Gravity.CENTER));
+ mAnimator = ObjectAnimator.ofFloat(mSurfaceView, "myTranslationY",
+ 0, size);
+ mAnimator.setRepeatMode(ObjectAnimator.REVERSE);
+ mAnimator.setRepeatCount(ObjectAnimator.INFINITE);
+ mAnimator.setDuration(200);
+ mAnimator.setInterpolator(new LinearInterpolator());
+ setContentView(content);
+ }
+
+ @Override
+ public void surfaceCreated(SurfaceHolder holder) {
+ }
+
+ @Override
+ public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
+ Canvas canvas = holder.lockCanvas();
+ canvas.drawARGB(0xFF, 0x00, 0xFF, 0x00);
+ holder.unlockCanvasAndPost(canvas);
+ }
+
+ @Override
+ public void surfaceDestroyed(SurfaceHolder holder) {
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ mAnimator.start();
+ }
+
+ @Override
+ protected void onPause() {
+ mAnimator.pause();
+ super.onPause();
+ }
+}