Merge "Whitelist all restricted permissions on sideload" into qt-dev
diff --git a/core/java/android/net/DnsResolver.java b/core/java/android/net/DnsResolver.java
index 7a85dcb..0b1a845 100644
--- a/core/java/android/net/DnsResolver.java
+++ b/core/java/android/net/DnsResolver.java
@@ -34,6 +34,7 @@
import android.annotation.Nullable;
import android.os.CancellationSignal;
import android.os.Looper;
+import android.os.MessageQueue;
import android.system.ErrnoException;
import android.util.Log;
@@ -466,10 +467,20 @@
private void registerFDListener(@NonNull Executor executor,
@NonNull FileDescriptor queryfd, @NonNull Callback<? super byte[]> answerCallback,
@Nullable CancellationSignal cancellationSignal, @NonNull Object lock) {
- Looper.getMainLooper().getQueue().addOnFileDescriptorEventListener(
+ final MessageQueue mainThreadMessageQueue = Looper.getMainLooper().getQueue();
+ mainThreadMessageQueue.addOnFileDescriptorEventListener(
queryfd,
FD_EVENTS,
(fd, events) -> {
+ // b/134310704
+ // Unregister fd event listener before resNetworkResult is called to prevent
+ // race condition caused by fd reused.
+ // For example when querying v4 and v6, it's possible that the first query ends
+ // and the fd is closed before the second request starts, which might return
+ // the same fd for the second request. By that time, the looper must have
+ // unregistered the fd, otherwise another event listener can't be registered.
+ mainThreadMessageQueue.removeOnFileDescriptorEventListener(fd);
+
executor.execute(() -> {
DnsResponse resp = null;
ErrnoException exception = null;
@@ -490,7 +501,11 @@
}
answerCallback.onAnswer(resp.answerbuf, resp.rcode);
});
- // Unregister this fd listener
+
+ // The file descriptor has already been unregistered, so it does not really
+ // matter what is returned here. In spirit 0 (meaning "unregister this FD")
+ // is still the closest to what the looper needs to do. When returning 0,
+ // Looper knows to ignore the fd if it has already been unregistered.
return 0;
});
}
diff --git a/core/java/android/os/ExternalVibration.java b/core/java/android/os/ExternalVibration.java
index b93bef8..37ca868 100644
--- a/core/java/android/os/ExternalVibration.java
+++ b/core/java/android/os/ExternalVibration.java
@@ -114,6 +114,24 @@
return true;
}
+ /**
+ * Links a recipient to death against this external vibration token
+ */
+ public void linkToDeath(IBinder.DeathRecipient recipient) {
+ try {
+ mToken.linkToDeath(recipient, 0);
+ } catch (RemoteException e) {
+ return;
+ }
+ }
+
+ /**
+ * Unlinks a recipient to death against this external vibration token
+ */
+ public void unlinkToDeath(IBinder.DeathRecipient recipient) {
+ mToken.unlinkToDeath(recipient, 0);
+ }
+
@Override
public boolean equals(Object o) {
if (o == null || !(o instanceof ExternalVibration)) {
diff --git a/core/java/android/provider/DeviceConfig.java b/core/java/android/provider/DeviceConfig.java
index 9a11104..19dbc6a 100644
--- a/core/java/android/provider/DeviceConfig.java
+++ b/core/java/android/provider/DeviceConfig.java
@@ -48,6 +48,8 @@
/**
* Device level configuration parameters which can be tuned by a separate configuration service.
+ * Namespaces that end in "_native" such as {@link #NAMESPACE_NETD_NATIVE} are intended to be used
+ * by native code and should be pushed to system properties to make them accessible.
*
* @hide
*/
diff --git a/core/java/android/view/accessibility/AccessibilityNodeIdManager.java b/core/java/android/view/accessibility/AccessibilityNodeIdManager.java
index 0f5e950..d78dadd 100644
--- a/core/java/android/view/accessibility/AccessibilityNodeIdManager.java
+++ b/core/java/android/view/accessibility/AccessibilityNodeIdManager.java
@@ -16,12 +16,11 @@
package android.view.accessibility;
-import android.util.SparseArray;
import android.view.View;
/** @hide */
public final class AccessibilityNodeIdManager {
- private SparseArray<View> mIdsToViews = new SparseArray<>();
+ private WeakSparseArray<View> mIdsToViews = new WeakSparseArray<View>();
private static AccessibilityNodeIdManager sIdManager;
/**
diff --git a/core/java/android/view/accessibility/WeakSparseArray.java b/core/java/android/view/accessibility/WeakSparseArray.java
new file mode 100644
index 0000000..04a4cc7
--- /dev/null
+++ b/core/java/android/view/accessibility/WeakSparseArray.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2019 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.accessibility;
+
+import android.util.SparseArray;
+
+import java.lang.ref.Reference;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
+
+
+final class WeakSparseArray<E> {
+
+ private final ReferenceQueue<E> mRefQueue = new ReferenceQueue<>();
+ private final SparseArray<WeakReferenceWithId<E>> mSparseArray = new SparseArray<>();
+
+ public void append(int key, E value) {
+ removeUnreachableValues();
+ mSparseArray.append(key, new WeakReferenceWithId(value, mRefQueue, key));
+ }
+
+ public void remove(int key) {
+ removeUnreachableValues();
+ mSparseArray.remove(key);
+ }
+
+ public E get(int key) {
+ removeUnreachableValues();
+ WeakReferenceWithId<E> ref = mSparseArray.get(key);
+ return ref != null ? ref.get() : null;
+ }
+
+ private void removeUnreachableValues() {
+ for (Reference ref = mRefQueue.poll(); ref != null; ref = mRefQueue.poll()) {
+ mSparseArray.remove(((WeakReferenceWithId) ref).mId);
+ }
+ }
+
+ private static class WeakReferenceWithId<E> extends WeakReference<E> {
+
+ final int mId;
+
+ WeakReferenceWithId(E referent, ReferenceQueue<? super E> q, int id) {
+ super(referent, q);
+ mId = id;
+ }
+ }
+}
+
diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java
index 18c6abb..50bb688 100644
--- a/core/java/android/widget/AbsSeekBar.java
+++ b/core/java/android/widget/AbsSeekBar.java
@@ -38,6 +38,11 @@
import android.view.inspector.InspectableProperty;
import com.android.internal.R;
+import com.android.internal.util.Preconditions;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
/**
@@ -91,6 +96,10 @@
@UnsupportedAppUsage
private boolean mIsDragging;
+ private List<Rect> mUserGestureExclusionRects = Collections.emptyList();
+ private final List<Rect> mGestureExclusionRects = new ArrayList<>();
+ private final Rect mThumbRect = new Rect();
+
public AbsSeekBar(Context context) {
super(context);
}
@@ -735,6 +744,27 @@
// Canvas will be translated, so 0,0 is where we start drawing
thumb.setBounds(left, top, right, bottom);
+ updateGestureExclusionRects();
+ }
+
+ @Override
+ public void setSystemGestureExclusionRects(@NonNull List<Rect> rects) {
+ Preconditions.checkNotNull(rects, "rects must not be null");
+ mUserGestureExclusionRects = rects;
+ updateGestureExclusionRects();
+ }
+
+ private void updateGestureExclusionRects() {
+ final Drawable thumb = mThumb;
+ if (thumb == null) {
+ super.setSystemGestureExclusionRects(mUserGestureExclusionRects);
+ return;
+ }
+ mGestureExclusionRects.clear();
+ thumb.copyBounds(mThumbRect);
+ mGestureExclusionRects.add(mThumbRect);
+ mGestureExclusionRects.addAll(mUserGestureExclusionRects);
+ super.setSystemGestureExclusionRects(mGestureExclusionRects);
}
/**
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index c9ef038..cac75cfd 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -134,6 +134,7 @@
import java.text.BreakIterator;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
@@ -5097,6 +5098,12 @@
void onHandleMoved() {}
public void onDetached() {}
+
+ @Override
+ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+ super.onSizeChanged(w, h, oldw, oldh);
+ setSystemGestureExclusionRects(Collections.singletonList(new Rect(0, 0, w, h)));
+ }
}
private class InsertionHandleView extends HandleView {
diff --git a/core/java/com/android/internal/colorextraction/ColorExtractor.java b/core/java/com/android/internal/colorextraction/ColorExtractor.java
index d9fd3b5..b27c11b 100644
--- a/core/java/com/android/internal/colorextraction/ColorExtractor.java
+++ b/core/java/com/android/internal/colorextraction/ColorExtractor.java
@@ -53,11 +53,13 @@
protected WallpaperColors mLockColors;
public ColorExtractor(Context context) {
- this(context, new Tonal(context), true /* immediately */);
+ this(context, new Tonal(context), true /* immediately */,
+ context.getSystemService(WallpaperManager.class));
}
@VisibleForTesting
- public ColorExtractor(Context context, ExtractionType extractionType, boolean immediately) {
+ public ColorExtractor(Context context, ExtractionType extractionType, boolean immediately,
+ WallpaperManager wallpaperManager) {
mContext = context;
mExtractionType = extractionType;
@@ -72,7 +74,6 @@
mOnColorsChangedListeners = new ArrayList<>();
- WallpaperManager wallpaperManager = mContext.getSystemService(WallpaperManager.class);
if (wallpaperManager == null) {
Log.w(TAG, "Can't listen to color changes!");
} else {
@@ -110,7 +111,7 @@
}
}
- private void extractWallpaperColors() {
+ protected void extractWallpaperColors() {
GradientColors[] systemColors = mGradientColors.get(WallpaperManager.FLAG_SYSTEM);
GradientColors[] lockColors = mGradientColors.get(WallpaperManager.FLAG_LOCK);
extractInto(mSystemColors,
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java
index 2736c6a..ee81868 100644
--- a/core/java/com/android/internal/os/Zygote.java
+++ b/core/java/com/android/internal/os/Zygote.java
@@ -519,6 +519,9 @@
try {
sessionSocket = usapPoolSocket.accept();
+ // Block SIGTERM so we won't be killed if the Zygote flushes the USAP pool.
+ blockSigTerm();
+
BufferedReader usapReader =
new BufferedReader(new InputStreamReader(sessionSocket.getInputStream()));
usapOutputStream =
@@ -537,87 +540,116 @@
} else {
Log.e("USAP", "Truncated command received.");
IoUtils.closeQuietly(sessionSocket);
+
+ // Re-enable SIGTERM so the USAP can be flushed from the pool if necessary.
+ unblockSigTerm();
}
} catch (Exception ex) {
Log.e("USAP", ex.getMessage());
IoUtils.closeQuietly(sessionSocket);
+
+ // Re-enable SIGTERM so the USAP can be flushed from the pool if necessary.
+ unblockSigTerm();
}
}
- applyUidSecurityPolicy(args, peerCredentials);
- applyDebuggerSystemProperty(args);
-
- int[][] rlimits = null;
-
- if (args.mRLimits != null) {
- rlimits = args.mRLimits.toArray(INT_ARRAY_2D);
- }
-
- // This must happen before the SELinux policy for this process is
- // changed when specializing.
try {
- // Used by ZygoteProcess.zygoteSendArgsAndGetResult to fill in a
- // Process.ProcessStartResult object.
- usapOutputStream.writeInt(pid);
- } catch (IOException ioEx) {
- Log.e("USAP", "Failed to write response to session socket: " + ioEx.getMessage());
- System.exit(-1);
- } finally {
- IoUtils.closeQuietly(sessionSocket);
+ // SIGTERM is blocked on loop exit. This prevents a USAP that is specializing from
+ // being killed during a pool flush.
+
+ applyUidSecurityPolicy(args, peerCredentials);
+ applyDebuggerSystemProperty(args);
+
+ int[][] rlimits = null;
+
+ if (args.mRLimits != null) {
+ rlimits = args.mRLimits.toArray(INT_ARRAY_2D);
+ }
+
+ // This must happen before the SELinux policy for this process is
+ // changed when specializing.
+ try {
+ // Used by ZygoteProcess.zygoteSendArgsAndGetResult to fill in a
+ // Process.ProcessStartResult object.
+ usapOutputStream.writeInt(pid);
+ } catch (IOException ioEx) {
+ Log.e("USAP", "Failed to write response to session socket: "
+ + ioEx.getMessage());
+ throw new RuntimeException(ioEx);
+ } finally {
+ IoUtils.closeQuietly(sessionSocket);
+
+ try {
+ // This socket is closed using Os.close due to an issue with the implementation
+ // of LocalSocketImp.close(). Because the raw FD is created by init and then
+ // loaded from an environment variable (as opposed to being created by the
+ // LocalSocketImpl itself) the current implementation will not actually close
+ // the underlying FD.
+ //
+ // See b/130309968 for discussion of this issue.
+ Os.close(usapPoolSocket.getFileDescriptor());
+ } catch (ErrnoException ex) {
+ Log.e("USAP", "Failed to close USAP pool socket");
+ throw new RuntimeException(ex);
+ }
+ }
try {
- // This socket is closed using Os.close due to an issue with the implementation of
- // LocalSocketImp.close. Because the raw FD is created by init and then loaded from
- // an environment variable (as opposed to being created by the LocalSocketImpl
- // itself) the current implementation will not actually close the underlying FD.
- //
- // See b/130309968 for discussion of this issue.
- Os.close(usapPoolSocket.getFileDescriptor());
- } catch (ErrnoException ex) {
- Log.e("USAP", "Failed to close USAP pool socket: " + ex.getMessage());
+ ByteArrayOutputStream buffer =
+ new ByteArrayOutputStream(Zygote.USAP_MANAGEMENT_MESSAGE_BYTES);
+ DataOutputStream outputStream = new DataOutputStream(buffer);
+
+ // This is written as a long so that the USAP reporting pipe and USAP pool event FD
+ // handlers in ZygoteServer.runSelectLoop can be unified. These two cases should
+ // both send/receive 8 bytes.
+ outputStream.writeLong(pid);
+ outputStream.flush();
+
+ Os.write(writePipe, buffer.toByteArray(), 0, buffer.size());
+ } catch (Exception ex) {
+ Log.e("USAP",
+ String.format("Failed to write PID (%d) to pipe (%d): %s",
+ pid, writePipe.getInt$(), ex.getMessage()));
+ throw new RuntimeException(ex);
+ } finally {
+ IoUtils.closeQuietly(writePipe);
}
- }
- try {
- ByteArrayOutputStream buffer =
- new ByteArrayOutputStream(Zygote.USAP_MANAGEMENT_MESSAGE_BYTES);
- DataOutputStream outputStream = new DataOutputStream(buffer);
+ specializeAppProcess(args.mUid, args.mGid, args.mGids,
+ args.mRuntimeFlags, rlimits, args.mMountExternal,
+ args.mSeInfo, args.mNiceName, args.mStartChildZygote,
+ args.mInstructionSet, args.mAppDataDir);
- // This is written as a long so that the USAP reporting pipe and USAP pool event FD
- // handlers in ZygoteServer.runSelectLoop can be unified. These two cases should both
- // send/receive 8 bytes.
- outputStream.writeLong(pid);
- outputStream.flush();
+ disableExecuteOnly(args.mTargetSdkVersion);
- Os.write(writePipe, buffer.toByteArray(), 0, buffer.size());
- } catch (Exception ex) {
- Log.e("USAP",
- String.format("Failed to write PID (%d) to pipe (%d): %s",
- pid, writePipe.getInt$(), ex.getMessage()));
- System.exit(-1);
+ if (args.mNiceName != null) {
+ Process.setArgV0(args.mNiceName);
+ }
+
+ // End of the postFork event.
+ Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
+
+ return ZygoteInit.zygoteInit(args.mTargetSdkVersion,
+ args.mRemainingArgs,
+ null /* classLoader */);
} finally {
- IoUtils.closeQuietly(writePipe);
+ // Unblock SIGTERM to restore the process to default behavior.
+ unblockSigTerm();
}
-
- specializeAppProcess(args.mUid, args.mGid, args.mGids,
- args.mRuntimeFlags, rlimits, args.mMountExternal,
- args.mSeInfo, args.mNiceName, args.mStartChildZygote,
- args.mInstructionSet, args.mAppDataDir);
-
- disableExecuteOnly(args.mTargetSdkVersion);
-
- if (args.mNiceName != null) {
- Process.setArgV0(args.mNiceName);
- }
-
- // End of the postFork event.
- Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
-
- return ZygoteInit.zygoteInit(args.mTargetSdkVersion,
- args.mRemainingArgs,
- null /* classLoader */);
}
+ private static void blockSigTerm() {
+ nativeBlockSigTerm();
+ }
+
+ private static native void nativeBlockSigTerm();
+
+ private static void unblockSigTerm() {
+ nativeUnblockSigTerm();
+ }
+
+ private static native void nativeUnblockSigTerm();
+
private static final String USAP_ERROR_PREFIX = "Invalid command to USAP: ";
/**
diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java
index 785256e..e556dd4 100644
--- a/core/java/com/android/internal/os/ZygoteConnection.java
+++ b/core/java/com/android/internal/os/ZygoteConnection.java
@@ -338,6 +338,7 @@
Runnable stateChangeCode) {
try {
if (zygoteServer.isUsapPoolEnabled()) {
+ Log.i(TAG, "Emptying USAP Pool due to state change.");
Zygote.emptyUsapPool();
}
@@ -351,6 +352,8 @@
if (fpResult != null) {
zygoteServer.setForkChild();
return fpResult;
+ } else {
+ Log.i(TAG, "Finished refilling USAP Pool after state change.");
}
}
diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java
index 585a279..2941a81 100644
--- a/core/java/com/android/internal/policy/DecorView.java
+++ b/core/java/com/android/internal/policy/DecorView.java
@@ -1004,6 +1004,10 @@
public void onWindowSystemUiVisibilityChanged(int visible) {
updateColorViews(null /* insets */, true /* animate */);
updateDecorCaptionStatus(getResources().getConfiguration());
+
+ if (mStatusGuard != null && mStatusGuard.getVisibility() == VISIBLE) {
+ updateStatusGuardColor();
+ }
}
@Override
@@ -1462,28 +1466,45 @@
}
final Rect rect = mTempRect;
- // If the parent doesn't consume the insets, manually
- // apply the default system window insets.
- mWindow.mContentParent.computeSystemWindowInsets(insets, rect);
- final int newMargin = rect.top == 0 ? insets.getSystemWindowInsetTop() : 0;
- if (mlp.topMargin != newMargin) {
- mlpChanged = true;
- mlp.topMargin = insets.getSystemWindowInsetTop();
+ // Apply the insets that have not been applied by the contentParent yet.
+ WindowInsets innerInsets =
+ mWindow.mContentParent.computeSystemWindowInsets(insets, rect);
+ int newTopMargin = innerInsets.getSystemWindowInsetTop();
+ int newLeftMargin = innerInsets.getSystemWindowInsetLeft();
+ int newRightMargin = innerInsets.getSystemWindowInsetRight();
- if (mStatusGuard == null) {
- mStatusGuard = new View(mContext);
- mStatusGuard.setBackgroundColor(mContext.getColor(
- R.color.decor_view_status_guard));
- addView(mStatusGuard, indexOfChild(mStatusColorViewState.view),
- new LayoutParams(LayoutParams.MATCH_PARENT,
- mlp.topMargin, Gravity.START | Gravity.TOP));
- } else {
- final LayoutParams lp = (LayoutParams)
- mStatusGuard.getLayoutParams();
- if (lp.height != mlp.topMargin) {
- lp.height = mlp.topMargin;
- mStatusGuard.setLayoutParams(lp);
- }
+ // Must use root window insets for the guard, because the color views consume
+ // the navigation bar inset if the window does not request LAYOUT_HIDE_NAV - but
+ // the status guard is attached at the root.
+ WindowInsets rootInsets = getRootWindowInsets();
+ int newGuardLeftMargin = rootInsets.getSystemWindowInsetLeft();
+ int newGuardRightMargin = rootInsets.getSystemWindowInsetRight();
+
+ if (mlp.topMargin != newTopMargin || mlp.leftMargin != newLeftMargin
+ || mlp.rightMargin != newRightMargin) {
+ mlpChanged = true;
+ mlp.topMargin = newTopMargin;
+ mlp.leftMargin = newLeftMargin;
+ mlp.rightMargin = newRightMargin;
+ }
+
+ if (newTopMargin > 0 && mStatusGuard == null) {
+ mStatusGuard = new View(mContext);
+ mStatusGuard.setVisibility(GONE);
+ final LayoutParams lp = new LayoutParams(MATCH_PARENT,
+ mlp.topMargin, Gravity.LEFT | Gravity.TOP);
+ lp.leftMargin = newGuardLeftMargin;
+ lp.rightMargin = newGuardRightMargin;
+ addView(mStatusGuard, indexOfChild(mStatusColorViewState.view), lp);
+ } else if (mStatusGuard != null) {
+ final LayoutParams lp = (LayoutParams)
+ mStatusGuard.getLayoutParams();
+ if (lp.height != mlp.topMargin || lp.leftMargin != newGuardLeftMargin
+ || lp.rightMargin != newGuardRightMargin) {
+ lp.height = mlp.topMargin;
+ lp.leftMargin = newGuardLeftMargin;
+ lp.rightMargin = newGuardRightMargin;
+ mStatusGuard.setLayoutParams(lp);
}
}
@@ -1491,6 +1512,11 @@
// always show the status guard above it if we have one.
showStatusGuard = mStatusGuard != null;
+ if (showStatusGuard && mStatusGuard.getVisibility() != VISIBLE) {
+ // If it wasn't previously shown, the color may be stale
+ updateStatusGuardColor();
+ }
+
// We only need to consume the insets if the action
// mode is overlaid on the app content (e.g. it's
// sitting in a FrameLayout, see
@@ -1502,7 +1528,7 @@
}
} else {
// reset top margin
- if (mlp.topMargin != 0) {
+ if (mlp.topMargin != 0 || mlp.leftMargin != 0 || mlp.rightMargin != 0) {
mlpChanged = true;
mlp.topMargin = 0;
}
@@ -1513,11 +1539,19 @@
}
}
if (mStatusGuard != null) {
- mStatusGuard.setVisibility(showStatusGuard ? View.VISIBLE : View.GONE);
+ mStatusGuard.setVisibility(showStatusGuard ? VISIBLE : GONE);
}
return insets;
}
+ private void updateStatusGuardColor() {
+ boolean lightStatusBar =
+ (getWindowSystemUiVisibility() & SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) != 0;
+ mStatusGuard.setBackgroundColor(lightStatusBar
+ ? mContext.getColor(R.color.decor_view_status_guard_light)
+ : mContext.getColor(R.color.decor_view_status_guard));
+ }
+
/**
* Overrides the view outline when the activity enters picture-in-picture to ensure that it has
* an opaque shadow even if the window background is completely transparent. This only applies
@@ -2594,6 +2628,7 @@
}
lastActionModeView.killMode();
mFadeAnim = null;
+ requestApplyInsets();
}
}
diff --git a/core/jni/android_media_AudioSystem.cpp b/core/jni/android_media_AudioSystem.cpp
index fc2b7f6..686a919 100644
--- a/core/jni/android_media_AudioSystem.cpp
+++ b/core/jni/android_media_AudioSystem.cpp
@@ -2242,6 +2242,12 @@
return AudioSystem::setAllowedCapturePolicy(uid, flags);
}
+static jint
+android_media_AudioSystem_setRttEnabled(JNIEnv *env, jobject thiz, jboolean enabled)
+{
+ return (jint) check_AudioSystem_Command(AudioSystem::setRttEnabled(enabled));
+}
+
// ----------------------------------------------------------------------------
static const JNINativeMethod gMethods[] = {
@@ -2319,6 +2325,7 @@
{"getHwOffloadEncodingFormatsSupportedForA2DP", "(Ljava/util/ArrayList;)I",
(void*)android_media_AudioSystem_getHwOffloadEncodingFormatsSupportedForA2DP},
{"setAllowedCapturePolicy", "(II)I", (void *)android_media_AudioSystem_setAllowedCapturePolicy},
+ {"setRttEnabled", "(Z)I", (void *)android_media_AudioSystem_setRttEnabled},
};
static const JNINativeMethod gEventHandlerMethods[] = {
diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp
index 842679e..14dbabb 100644
--- a/core/jni/android_os_Debug.cpp
+++ b/core/jni/android_os_Debug.cpp
@@ -713,16 +713,20 @@
O_CREAT | O_WRONLY | O_NOFOLLOW | O_CLOEXEC | O_APPEND,
0666));
if (fd < 0) {
- fprintf(stderr, "Can't open %s: %s\n", fileNameChars.c_str(), strerror(errno));
+ PLOG(ERROR) << "Can't open " << fileNameChars.c_str();
return false;
}
- return (dump_backtrace_to_file_timeout(pid, dumpType, timeoutSecs, fd) == 0);
+ int res = dump_backtrace_to_file_timeout(pid, dumpType, timeoutSecs, fd);
+ if (fdatasync(fd.get()) != 0) {
+ PLOG(ERROR) << "Failed flushing trace.";
+ }
+ return res == 0;
}
static jboolean android_os_Debug_dumpJavaBacktraceToFileTimeout(JNIEnv* env, jobject clazz,
jint pid, jstring fileName, jint timeoutSecs) {
- const bool ret = dumpTraces(env, pid, fileName, timeoutSecs, kDebuggerdJavaBacktrace);
+ const bool ret = dumpTraces(env, pid, fileName, timeoutSecs, kDebuggerdJavaBacktrace);
return ret ? JNI_TRUE : JNI_FALSE;
}
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 8ff1691..4783a25 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -198,7 +198,7 @@
* PIDs don't match nothing will happen.
*
* @param pid The ID of the process who's entry we want to clear.
- * @return True if the entry was cleared; false otherwise
+ * @return True if the entry was cleared by this call; false otherwise
*/
bool ClearForPID(int32_t pid) {
EntryStorage storage = mStorage.load();
@@ -212,14 +212,16 @@
* 3) It fails and the new value isn't INVALID_ENTRY_VALUE, in which
* case the entry has already been cleared and re-used.
*
- * In all three cases the goal of the caller has been met and we can
- * return true.
+ * In all three cases the goal of the caller has been met, but only in
+ * the first case do we need to decrement the pool count.
*/
if (mStorage.compare_exchange_strong(storage, INVALID_ENTRY_VALUE)) {
close(storage.read_pipe_fd);
+ return true;
+ } else {
+ return false;
}
- return true;
} else {
return false;
}
@@ -331,11 +333,24 @@
if (WIFEXITED(status)) {
async_safe_format_log(ANDROID_LOG_INFO, LOG_TAG,
"Process %d exited cleanly (%d)", pid, WEXITSTATUS(status));
+
+ // Check to see if the PID is in the USAP pool and remove it if it is.
+ if (RemoveUsapTableEntry(pid)) {
+ ++usaps_removed;
+ }
} else if (WIFSIGNALED(status)) {
async_safe_format_log(ANDROID_LOG_INFO, LOG_TAG,
"Process %d exited due to signal %d (%s)%s", pid,
WTERMSIG(status), strsignal(WTERMSIG(status)),
WCOREDUMP(status) ? "; core dumped" : "");
+
+ // If the process exited due to a signal other than SIGTERM, check to see
+ // if the PID is in the USAP pool and remove it if it is. If the process
+ // was closed by the Zygote using SIGTERM then the USAP pool entry will
+ // have already been removed (see nativeEmptyUsapPool()).
+ if (WTERMSIG(status) != SIGTERM && RemoveUsapTableEntry(pid)) {
+ ++usaps_removed;
+ }
}
// If the just-crashed process is the system_server, bring down zygote
@@ -346,11 +361,6 @@
"Exit zygote because system server (pid %d) has terminated", pid);
kill(getpid(), SIGKILL);
}
-
- // Check to see if the PID is in the USAP pool and remove it if it is.
- if (RemoveUsapTableEntry(pid)) {
- ++usaps_removed;
- }
}
// Note that we shouldn't consider ECHILD an error because
@@ -1648,7 +1658,13 @@
auto entry_storage = entry.GetValues();
if (entry_storage.has_value()) {
- kill(entry_storage.value().pid, SIGKILL);
+ kill(entry_storage.value().pid, SIGTERM);
+
+ // Clean up the USAP table entry here. This avoids a potential race
+ // where a newly created USAP might not be able to find a valid table
+ // entry if signal handler (which would normally do the cleanup) doesn't
+ // run between now and when the new process is created.
+
close(entry_storage.value().read_pipe_fd);
// Avoid a second atomic load by invalidating instead of clearing.
@@ -1678,6 +1694,16 @@
return dl_iterate_phdr(disable_execute_only, nullptr) == 0;
}
+static void com_android_internal_os_Zygote_nativeBlockSigTerm(JNIEnv* env, jclass) {
+ auto fail_fn = std::bind(ZygoteFailure, env, "usap", nullptr, _1);
+ BlockSignal(SIGTERM, fail_fn);
+}
+
+static void com_android_internal_os_Zygote_nativeUnblockSigTerm(JNIEnv* env, jclass) {
+ auto fail_fn = std::bind(ZygoteFailure, env, "usap", nullptr, _1);
+ UnblockSignal(SIGTERM, fail_fn);
+}
+
static const JNINativeMethod gMethods[] = {
{ "nativeForkAndSpecialize",
"(II[II[[IILjava/lang/String;Ljava/lang/String;[I[IZLjava/lang/String;Ljava/lang/String;)I",
@@ -1708,7 +1734,11 @@
{ "nativeEmptyUsapPool", "()V",
(void *) com_android_internal_os_Zygote_nativeEmptyUsapPool },
{ "nativeDisableExecuteOnly", "()Z",
- (void *) com_android_internal_os_Zygote_nativeDisableExecuteOnly }
+ (void *) com_android_internal_os_Zygote_nativeDisableExecuteOnly },
+ { "nativeBlockSigTerm", "()V",
+ (void* ) com_android_internal_os_Zygote_nativeBlockSigTerm },
+ { "nativeUnblockSigTerm", "()V",
+ (void* ) com_android_internal_os_Zygote_nativeUnblockSigTerm }
};
int register_com_android_internal_os_Zygote(JNIEnv* env) {
diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml
index 3b28265..1dcd389 100644
--- a/core/res/res/values/colors.xml
+++ b/core/res/res/values/colors.xml
@@ -79,6 +79,7 @@
<drawable name="input_method_fullscreen_background">#fff9f9f9</drawable>
<color name="decor_view_status_guard">#ff000000</color>
+ <color name="decor_view_status_guard_light">#ffffffff</color>
<!-- For date picker widget -->
<drawable name="selected_day_background">#ff0092f4</drawable>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 641f223..9d75654 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1962,6 +1962,7 @@
<java-symbol type="bool" name="show_ongoing_ime_switcher" />
<java-symbol type="color" name="config_defaultNotificationColor" />
<java-symbol type="color" name="decor_view_status_guard" />
+ <java-symbol type="color" name="decor_view_status_guard_light" />
<java-symbol type="drawable" name="ic_notification_ime_default" />
<java-symbol type="drawable" name="ic_menu_refresh" />
<java-symbol type="drawable" name="ic_settings" />
@@ -3803,7 +3804,9 @@
<java-symbol type="string" name="chooser_all_apps_button_label" />
<java-symbol type="anim" name="resolver_launch_anim" />
<java-symbol type="style" name="Animation.DeviceDefault.Activity.Resolver" />
-
+
+ <java-symbol type="color" name="decor_view_status_guard_light" />
+
<java-symbol type="string" name="config_defaultSupervisionProfileOwnerComponent" />
<java-symbol type="bool" name="config_inflateSignalStrength" />
</resources>
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java
index fde0e64..53bc65d 100644
--- a/media/java/android/media/AudioSystem.java
+++ b/media/java/android/media/AudioSystem.java
@@ -24,7 +24,6 @@
import android.content.pm.PackageManager;
import android.media.audiofx.AudioEffect;
import android.media.audiopolicy.AudioMix;
-import android.os.Build;
import android.util.Log;
import java.util.ArrayList;
@@ -981,6 +980,8 @@
public static native boolean getMasterMono();
/** @hide enables or disables the master mono mode. */
public static native int setMasterMono(boolean mono);
+ /** @hide enables or disables the RTT mode. */
+ public static native int setRttEnabled(boolean enabled);
/** @hide returns master balance value in range -1.f -> 1.f, where 0.f is dead center. */
@TestApi
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsActivity.java
index 79c691c..a7ccc3a 100644
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsActivity.java
+++ b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsActivity.java
@@ -323,7 +323,7 @@
mColorExtractor = Dependency.get(SysuiColorExtractor.class);
mColorExtractor.addOnColorsChangedListener(this);
mUsingDarkText = mColorExtractor.getColors(ColorExtractor.TYPE_DARK,
- WallpaperManager.FLAG_SYSTEM, true).supportsDarkText();
+ WallpaperManager.FLAG_SYSTEM).supportsDarkText();
setTheme(mUsingDarkText ? R.style.RecentsTheme_Wallpaper_Light
: R.style.RecentsTheme_Wallpaper);
@@ -394,8 +394,6 @@
@Override
public void onColorsChanged(ColorExtractor colorExtractor, int which) {
if ((which & WallpaperManager.FLAG_SYSTEM) != 0) {
- // Recents doesn't care about the wallpaper being visible or not, it always
- // wants to scrim with wallpaper colors
ColorExtractor.GradientColors colors = mColorExtractor.getNeutralColors();
boolean darkText = colors.supportsDarkText();
if (darkText != mUsingDarkText) {
diff --git a/packages/SystemUI/res-keyguard/values/styles.xml b/packages/SystemUI/res-keyguard/values/styles.xml
index 9a04222..67c4458 100644
--- a/packages/SystemUI/res-keyguard/values/styles.xml
+++ b/packages/SystemUI/res-keyguard/values/styles.xml
@@ -111,7 +111,7 @@
<item name="android:colorBackground">@*android:color/background_material_dark</item>
</style>
- <style name="TextAppearance.Keyguard" parent="Theme.SystemUI">
+ <style name="TextAppearance.Keyguard">
<item name="android:textSize">@dimen/widget_title_font_size</item>
<item name="android:gravity">center</item>
<item name="android:ellipsize">end</item>
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java
index 6b07ed8..a2abb4b 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java
@@ -64,6 +64,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.Future;
import java.util.function.Consumer;
public class ActivityManagerWrapper {
@@ -380,8 +381,8 @@
/**
* Requests that the system close any open system windows (including other SystemUI).
*/
- public void closeSystemWindows(final String reason) {
- mBackgroundExecutor.submit(new Runnable() {
+ public Future<?> closeSystemWindows(final String reason) {
+ return mBackgroundExecutor.submit(new Runnable() {
@Override
public void run() {
try {
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
index 0bb9e744..7ec1bda 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
@@ -374,7 +374,7 @@
private void updateColors() {
ColorExtractor.GradientColors colors = mSysuiColorExtractor.getColors(
- WallpaperManager.FLAG_LOCK, true);
+ WallpaperManager.FLAG_LOCK);
mSupportsDarkText = colors.supportsDarkText();
mColorPalette = colors.getColorPalette();
if (mClockPlugin != null) {
diff --git a/packages/SystemUI/src/com/android/keyguard/clock/AnalogClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/AnalogClockController.java
index f468eca..558ac4b 100644
--- a/packages/SystemUI/src/com/android/keyguard/clock/AnalogClockController.java
+++ b/packages/SystemUI/src/com/android/keyguard/clock/AnalogClockController.java
@@ -130,7 +130,7 @@
setDarkAmount(1f);
setTextColor(Color.WHITE);
ColorExtractor.GradientColors colors = mColorExtractor.getColors(
- WallpaperManager.FLAG_LOCK, true);
+ WallpaperManager.FLAG_LOCK);
setColorPalette(colors.supportsDarkText(), colors.getColorPalette());
onTimeTick();
diff --git a/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java
index 61a6952..bdf9dc4 100644
--- a/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java
+++ b/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java
@@ -130,7 +130,7 @@
setDarkAmount(1f);
setTextColor(Color.WHITE);
ColorExtractor.GradientColors colors = mColorExtractor.getColors(
- WallpaperManager.FLAG_LOCK, true);
+ WallpaperManager.FLAG_LOCK);
setColorPalette(colors.supportsDarkText(), colors.getColorPalette());
onTimeTick();
diff --git a/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java
index ce1f09c..98679ade 100644
--- a/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java
+++ b/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java
@@ -124,7 +124,7 @@
setDarkAmount(1f);
setTextColor(Color.WHITE);
ColorExtractor.GradientColors colors = mColorExtractor.getColors(
- WallpaperManager.FLAG_LOCK, true);
+ WallpaperManager.FLAG_LOCK);
setColorPalette(colors.supportsDarkText(), colors.getColorPalette());
onTimeTick();
diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
index 305558f..7d36469 100644
--- a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
+++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
@@ -911,6 +911,7 @@
if (shouldDrawCutout(getContext()) && hasCutout()) {
mBounds.addAll(mInfo.displayCutout.getBoundingRects());
localBounds(mBoundingRect);
+ updateGravity();
updateBoundingPath();
invalidate();
newVisible = VISIBLE;
@@ -961,6 +962,18 @@
}
}
+ private void updateGravity() {
+ LayoutParams lp = getLayoutParams();
+ if (lp instanceof FrameLayout.LayoutParams) {
+ FrameLayout.LayoutParams flp = (FrameLayout.LayoutParams) lp;
+ int newGravity = getGravity(mInfo.displayCutout);
+ if (flp.gravity != newGravity) {
+ flp.gravity = newGravity;
+ setLayoutParams(flp);
+ }
+ }
+ }
+
private boolean hasCutout() {
final DisplayCutout displayCutout = mInfo.displayCutout;
if (displayCutout == null) {
@@ -1007,21 +1020,25 @@
}
private void localBounds(Rect out) {
- final DisplayCutout displayCutout = mInfo.displayCutout;
+ DisplayCutout displayCutout = mInfo.displayCutout;
+ boundsFromDirection(displayCutout, getGravity(displayCutout), out);
+ }
+ private int getGravity(DisplayCutout displayCutout) {
if (mStart) {
if (displayCutout.getSafeInsetLeft() > 0) {
- boundsFromDirection(displayCutout, Gravity.LEFT, out);
+ return Gravity.LEFT;
} else if (displayCutout.getSafeInsetTop() > 0) {
- boundsFromDirection(displayCutout, Gravity.TOP, out);
+ return Gravity.TOP;
}
} else {
if (displayCutout.getSafeInsetRight() > 0) {
- boundsFromDirection(displayCutout, Gravity.RIGHT, out);
+ return Gravity.RIGHT;
} else if (displayCutout.getSafeInsetBottom() > 0) {
- boundsFromDirection(displayCutout, Gravity.BOTTOM, out);
+ return Gravity.BOTTOM;
}
}
+ return Gravity.NO_GRAVITY;
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java b/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java
index b7479985..002d4f3 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java
@@ -243,12 +243,12 @@
return;
}
- mHandlesShowing = false;
- mHandlesLastHiddenAt = SystemClock.elapsedRealtime();
ScreenDecorations screenDecorations = mScreenDecorationsSupplier.get();
if (screenDecorations == null) {
Log.w(TAG, "Couldn't hide handles, ScreenDecorations unavailable");
} else {
+ mHandlesShowing = false;
+ mHandlesLastHiddenAt = SystemClock.elapsedRealtime();
screenDecorations.setAssistHintVisible(false);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java b/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java
index 835ffc9..6f56a53 100644
--- a/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java
+++ b/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java
@@ -16,18 +16,11 @@
package com.android.systemui.colorextraction;
-import android.annotation.ColorInt;
import android.app.WallpaperColors;
import android.app.WallpaperManager;
import android.content.Context;
-import android.os.Handler;
-import android.os.RemoteException;
+import android.graphics.Color;
import android.os.UserHandle;
-import android.util.Log;
-import android.view.Display;
-import android.view.IWallpaperVisibilityListener;
-import android.view.IWindowManager;
-import android.view.WindowManagerGlobal;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.colorextraction.ColorExtractor;
@@ -52,46 +45,28 @@
ConfigurationController.ConfigurationListener {
private static final String TAG = "SysuiColorExtractor";
private final Tonal mTonal;
- private boolean mWallpaperVisible;
- private boolean mHasBackdrop;
- // Colors to return when the wallpaper isn't visible
- private final GradientColors mWpHiddenColors;
+ private boolean mHasMediaArtwork;
+ private final GradientColors mNeutralColorsLock;
+ private final GradientColors mBackdropColors;
@Inject
public SysuiColorExtractor(Context context, ConfigurationController configurationController) {
- this(context, new Tonal(context), configurationController, true);
+ this(context, new Tonal(context), configurationController,
+ context.getSystemService(WallpaperManager.class), false /* immediately */);
}
@VisibleForTesting
public SysuiColorExtractor(Context context, ExtractionType type,
- ConfigurationController configurationController, boolean registerVisibility) {
- super(context, type, false /* immediately */);
+ ConfigurationController configurationController,
+ WallpaperManager wallpaperManager, boolean immediately) {
+ super(context, type, immediately, wallpaperManager);
mTonal = type instanceof Tonal ? (Tonal) type : new Tonal(context);
- mWpHiddenColors = new GradientColors();
+ mNeutralColorsLock = new GradientColors();
configurationController.addCallback(this);
- WallpaperColors systemColors = getWallpaperColors(WallpaperManager.FLAG_SYSTEM);
- updateDefaultGradients(systemColors);
+ mBackdropColors = new GradientColors();
+ mBackdropColors.setMainColor(Color.BLACK);
- if (registerVisibility) {
- try {
- IWindowManager windowManagerService = WindowManagerGlobal.getWindowManagerService();
- Handler handler = Handler.getMain();
- boolean visible = windowManagerService.registerWallpaperVisibilityListener(
- new IWallpaperVisibilityListener.Stub() {
- @Override
- public void onWallpaperVisibilityChanged(boolean newVisibility,
- int displayId) throws RemoteException {
- handler.post(() -> setWallpaperVisible(newVisibility));
- }
- }, Display.DEFAULT_DISPLAY);
- setWallpaperVisible(visible);
- } catch (RemoteException e) {
- Log.w(TAG, "Can't listen to wallpaper visibility changes", e);
- }
- }
-
- WallpaperManager wallpaperManager = context.getSystemService(WallpaperManager.class);
if (wallpaperManager != null) {
// Listen to all users instead of only the current one.
wallpaperManager.removeOnColorsChangedListener(this);
@@ -100,8 +75,14 @@
}
}
- private void updateDefaultGradients(WallpaperColors colors) {
- mTonal.applyFallback(colors, mWpHiddenColors);
+ @Override
+ protected void extractWallpaperColors() {
+ super.extractWallpaperColors();
+ // mTonal is final but this method will be invoked by the base class during its ctor.
+ if (mTonal == null) {
+ return;
+ }
+ mTonal.applyFallback(mLockColors == null ? mSystemColors : mLockColors, mNeutralColorsLock);
}
@Override
@@ -110,27 +91,28 @@
// Colors do not belong to current user, ignoring.
return;
}
-
- super.onColorsChanged(colors, which);
-
- if ((which & WallpaperManager.FLAG_SYSTEM) != 0) {
- @ColorInt int oldColor = mWpHiddenColors.getMainColor();
- updateDefaultGradients(colors);
- if (oldColor != mWpHiddenColors.getMainColor()) {
- triggerColorsChanged(WallpaperManager.FLAG_SYSTEM);
- }
+ if ((which & WallpaperManager.FLAG_LOCK) != 0) {
+ mTonal.applyFallback(colors, mNeutralColorsLock);
}
+ super.onColorsChanged(colors, which);
}
@Override
public void onUiModeChanged() {
- WallpaperColors systemColors = getWallpaperColors(WallpaperManager.FLAG_SYSTEM);
- updateDefaultGradients(systemColors);
- triggerColorsChanged(WallpaperManager.FLAG_SYSTEM);
+ extractWallpaperColors();
+ triggerColorsChanged(WallpaperManager.FLAG_SYSTEM | WallpaperManager.FLAG_LOCK);
+ }
+
+ @Override
+ public GradientColors getColors(int which, int type) {
+ if (mHasMediaArtwork && (which & WallpaperManager.FLAG_LOCK) != 0) {
+ return mBackdropColors;
+ }
+ return super.getColors(which, type);
}
/**
- * Colors the should be using for scrims.
+ * Colors that should be using for scrims.
*
* They will be:
* - A light gray if the wallpaper is light
@@ -138,81 +120,12 @@
* - Black otherwise
*/
public GradientColors getNeutralColors() {
- return mWpHiddenColors;
+ return mHasMediaArtwork ? mBackdropColors : mNeutralColorsLock;
}
- /**
- * Get TYPE_NORMAL colors when wallpaper is visible, or fallback otherwise.
- *
- * @param which FLAG_LOCK or FLAG_SYSTEM
- * @return colors
- */
- @Override
- public GradientColors getColors(int which) {
- return getColors(which, TYPE_DARK);
- }
-
- /**
- * Wallpaper colors when the wallpaper is visible, fallback otherwise.
- *
- * @param which FLAG_LOCK or FLAG_SYSTEM
- * @param type TYPE_NORMAL, TYPE_DARK or TYPE_EXTRA_DARK
- * @return colors
- */
- @Override
- public GradientColors getColors(int which, int type) {
- return getColors(which, type, false /* ignoreVisibility */);
- }
-
- /**
- * Get TYPE_NORMAL colors, possibly ignoring wallpaper visibility.
- *
- * @param which FLAG_LOCK or FLAG_SYSTEM
- * @param ignoreWallpaperVisibility whether you want fallback colors or not if the wallpaper
- * isn't visible
- * @return
- */
- public GradientColors getColors(int which, boolean ignoreWallpaperVisibility) {
- return getColors(which, TYPE_NORMAL, ignoreWallpaperVisibility);
- }
-
- /**
- *
- * @param which FLAG_LOCK or FLAG_SYSTEM
- * @param type TYPE_NORMAL, TYPE_DARK or TYPE_EXTRA_DARK
- * @param ignoreWallpaperVisibility true if true wallpaper colors should be returning
- * if it's visible or not
- * @return colors
- */
- public GradientColors getColors(int which, int type, boolean ignoreWallpaperVisibility) {
- // mWallpaperVisible only handles the "system wallpaper" and will be always set to false
- // if we have different lock and system wallpapers.
- if (which == WallpaperManager.FLAG_SYSTEM) {
- if (mWallpaperVisible || ignoreWallpaperVisibility) {
- return super.getColors(which, type);
- } else {
- return mWpHiddenColors;
- }
- } else {
- if (mHasBackdrop) {
- return mWpHiddenColors;
- } else {
- return super.getColors(which, type);
- }
- }
- }
-
- @VisibleForTesting
- void setWallpaperVisible(boolean visible) {
- if (mWallpaperVisible != visible) {
- mWallpaperVisible = visible;
- triggerColorsChanged(WallpaperManager.FLAG_SYSTEM);
- }
- }
-
- public void setHasBackdrop(boolean hasBackdrop) {
- if (mHasBackdrop != hasBackdrop) {
- mHasBackdrop = hasBackdrop;
+ public void setHasMediaArtwork(boolean hasBackdrop) {
+ if (mHasMediaArtwork != hasBackdrop) {
+ mHasMediaArtwork = hasBackdrop;
triggerColorsChanged(WallpaperManager.FLAG_LOCK);
}
}
@@ -230,7 +143,8 @@
pw.println(" Gradients:");
pw.println(" system: " + Arrays.toString(system));
pw.println(" lock: " + Arrays.toString(lock));
- pw.println(" Default scrim: " + mWpHiddenColors);
+ pw.println(" Neutral colors: " + mNeutralColorsLock);
+ pw.println(" Has media backdrop: " + mHasMediaArtwork);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
index 341461b..11ca94f 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
@@ -92,6 +92,11 @@
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+
/**
* POD used in the AsyncTask which saves an image in the background.
@@ -446,6 +451,8 @@
static final String EXTRA_CANCEL_NOTIFICATION = "android:screenshot_cancel_notification";
static final String EXTRA_DISALLOW_ENTER_PIP = "android:screenshot_disallow_enter_pip";
+ private static final String TAG = "GlobalScreenshot";
+
private static final int SCREENSHOT_FLASH_TO_PEAK_DURATION = 130;
private static final int SCREENSHOT_DROP_IN_DURATION = 430;
private static final int SCREENSHOT_DROP_OUT_DELAY = 500;
@@ -902,11 +909,19 @@
* appropriate signals to the system (ie. to dismiss the keyguard if necessary).
*/
public static class ActionProxyReceiver extends BroadcastReceiver {
+ static final int CLOSE_WINDOWS_TIMEOUT_MILLIS = 3000;
+
@Override
public void onReceive(Context context, final Intent intent) {
Runnable startActivityRunnable = () -> {
- ActivityManagerWrapper.getInstance().closeSystemWindows(
- SYSTEM_DIALOG_REASON_SCREENSHOT);
+ try {
+ ActivityManagerWrapper.getInstance().closeSystemWindows(
+ SYSTEM_DIALOG_REASON_SCREENSHOT).get(
+ CLOSE_WINDOWS_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
+ } catch (TimeoutException | InterruptedException | ExecutionException e) {
+ Slog.e(TAG, "Unable to share screenshot", e);
+ return;
+ }
Intent actionIntent = intent.getParcelableExtra(EXTRA_ACTION_INTENT);
if (intent.getBooleanExtra(EXTRA_CANCEL_NOTIFICATION, false)) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
index 75ef185..6c36ab9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
@@ -488,6 +488,7 @@
if (bmp != null) {
artworkDrawable = new BitmapDrawable(mBackdropBack.getResources(), bmp);
}
+ boolean hasMediaArtwork = artworkDrawable != null;
boolean allowWhenShade = false;
if (ENABLE_LOCKSCREEN_WALLPAPER && artworkDrawable == null) {
Bitmap lockWallpaper =
@@ -506,7 +507,7 @@
boolean hideBecauseOccluded = shadeController != null && shadeController.isOccluded();
final boolean hasArtwork = artworkDrawable != null;
- mColorExtractor.setHasBackdrop(hasArtwork);
+ mColorExtractor.setHasMediaArtwork(hasMediaArtwork);
if (mScrimController != null) {
mScrimController.setHasBackdrop(hasArtwork);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index d219ac9..95eaf4f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -654,15 +654,7 @@
@Override
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void onThemeChanged() {
- int which;
- if (mStatusBarState == StatusBarState.KEYGUARD
- || mStatusBarState == StatusBarState.SHADE_LOCKED) {
- which = WallpaperManager.FLAG_LOCK;
- } else {
- which = WallpaperManager.FLAG_SYSTEM;
- }
- final boolean useDarkText = mColorExtractor.getColors(which,
- true /* ignoreVisibility */).supportsDarkText();
+ final boolean useDarkText = mColorExtractor.getNeutralColors().supportsDarkText();
updateDecorViews(useDarkText);
updateFooter();
@@ -868,8 +860,8 @@
int backgroundRectTop = top;
int lastSectionBottom =
mSections[0].getCurrentBounds().bottom + animationYOffset;
- int previousLeft = left;
- int previousRight = right;
+ int currentLeft = left;
+ int currentRight = right;
boolean first = true;
for (NotificationSection section : mSections) {
if (section.getFirstVisibleChild() == null) {
@@ -882,23 +874,23 @@
// as separate roundrects, as the rounded corners right next to each other look
// bad.
if (sectionTop - lastSectionBottom > DISTANCE_BETWEEN_ADJACENT_SECTIONS_PX
- || (previousLeft != ownLeft && !first)) {
- canvas.drawRoundRect(ownLeft,
+ || ((currentLeft != ownLeft || currentRight != ownRight) && !first)) {
+ canvas.drawRoundRect(currentLeft,
backgroundRectTop,
- ownRight,
+ currentRight,
lastSectionBottom,
mCornerRadius, mCornerRadius, mBackgroundPaint);
backgroundRectTop = sectionTop;
}
- previousLeft = ownLeft;
- previousRight = ownRight;
+ currentLeft = ownLeft;
+ currentRight = ownRight;
lastSectionBottom =
section.getCurrentBounds().bottom + animationYOffset;
first = false;
}
- canvas.drawRoundRect(previousLeft,
+ canvas.drawRoundRect(currentLeft,
backgroundRectTop,
- previousRight,
+ currentRight,
lastSectionBottom,
mCornerRadius, mCornerRadius, mBackgroundPaint);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java
index 7cd8f7b..77eb469 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java
@@ -24,6 +24,9 @@
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY;
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
@@ -38,13 +41,16 @@
import android.os.UserHandle;
import android.provider.Settings;
import android.provider.Settings.Secure;
+import android.text.TextUtils;
import android.util.Log;
import android.util.SparseBooleanArray;
import com.android.systemui.Dumpable;
+import com.android.systemui.R;
import com.android.systemui.UiOffloadThread;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
+import com.android.systemui.util.NotificationChannels;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -63,6 +69,9 @@
private static final String TAG = NavigationModeController.class.getSimpleName();
private static final boolean DEBUG = false;
+ static final String SHARED_PREFERENCES_NAME = "navigation_mode_controller_preferences";
+ static final String PREFS_SWITCHED_FROM_GESTURE_NAV_KEY = "switched_from_gesture_nav";
+
public interface ModeChangedListener {
void onNavigationModeChanged(int mode);
}
@@ -78,6 +87,8 @@
private int mMode = NAV_BAR_MODE_3BUTTON;
private ArrayList<ModeChangedListener> mListeners = new ArrayList<>();
+ private String mLastDefaultLauncher;
+
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -92,7 +103,13 @@
if (DEBUG) {
Log.d(TAG, "ACTION_PREFERRED_ACTIVITY_CHANGED");
}
- switchFromGestureNavModeIfNotSupportedByDefaultLauncher();
+ final String launcher = getDefaultLauncherPackageName(mCurrentUserContext);
+ // Check if it is a default launcher change
+ if (!TextUtils.equals(mLastDefaultLauncher, launcher)) {
+ switchFromGestureNavModeIfNotSupportedByDefaultLauncher();
+ showNotificationIfDefaultLauncherSupportsGestureNav();
+ mLastDefaultLauncher = launcher;
+ }
break;
}
}
@@ -157,6 +174,8 @@
IntentFilter preferredActivityFilter = new IntentFilter(ACTION_PREFERRED_ACTIVITY_CHANGED);
mContext.registerReceiverAsUser(mReceiver, UserHandle.ALL, preferredActivityFilter, null,
null);
+ // We are only interested in launcher changes, so keeping track of the current default.
+ mLastDefaultLauncher = getDefaultLauncherPackageName(mContext);
updateCurrentInteractionMode(false /* notify */);
switchFromGestureNavModeIfNotSupportedByDefaultLauncher();
@@ -287,6 +306,84 @@
});
}
+ private void switchFromGestureNavModeIfNotSupportedByDefaultLauncher() {
+ if (getCurrentInteractionMode(mCurrentUserContext) != NAV_BAR_MODE_GESTURAL) {
+ return;
+ }
+ final Boolean supported = isGestureNavSupportedByDefaultLauncher(mCurrentUserContext);
+ if (supported == null || supported) {
+ return;
+ }
+
+ setModeOverlay(NAV_BAR_MODE_3BUTTON_OVERLAY, USER_CURRENT);
+ showNotification(mCurrentUserContext, R.string.notification_content_system_nav_changed);
+ mCurrentUserContext.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE)
+ .edit().putBoolean(PREFS_SWITCHED_FROM_GESTURE_NAV_KEY, true).apply();
+ }
+
+ private void showNotificationIfDefaultLauncherSupportsGestureNav() {
+ boolean previouslySwitchedFromGestureNav = mCurrentUserContext
+ .getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE)
+ .getBoolean(PREFS_SWITCHED_FROM_GESTURE_NAV_KEY, false);
+ if (!previouslySwitchedFromGestureNav) {
+ return;
+ }
+ if (getCurrentInteractionMode(mCurrentUserContext) == NAV_BAR_MODE_GESTURAL) {
+ return;
+ }
+ final Boolean supported = isGestureNavSupportedByDefaultLauncher(mCurrentUserContext);
+ if (supported == null || !supported) {
+ return;
+ }
+
+ showNotification(mCurrentUserContext, R.string.notification_content_gesture_nav_available);
+ mCurrentUserContext.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE)
+ .edit().putBoolean(PREFS_SWITCHED_FROM_GESTURE_NAV_KEY, false).apply();
+ }
+
+ /**
+ * Returns null if there is no default launcher set for the current user. Returns true if the
+ * current default launcher supports Gesture Navigation. Returns false otherwise.
+ */
+ private Boolean isGestureNavSupportedByDefaultLauncher(Context context) {
+ final String defaultLauncherPackageName = getDefaultLauncherPackageName(context);
+ if (DEBUG) {
+ Log.d(TAG, "isGestureNavSupportedByDefaultLauncher:"
+ + " defaultLauncher=" + defaultLauncherPackageName
+ + " contextUser=" + context.getUserId());
+ }
+ if (defaultLauncherPackageName == null) {
+ return null;
+ }
+ ComponentName recentsComponentName = ComponentName.unflattenFromString(
+ context.getString(com.android.internal.R.string.config_recentsComponentName));
+ return recentsComponentName.getPackageName().equals(defaultLauncherPackageName);
+ }
+
+ private String getDefaultLauncherPackageName(Context context) {
+ final ComponentName cn = context.getPackageManager().getHomeActivities(new ArrayList<>());
+ if (cn == null) {
+ return null;
+ }
+ return cn.getPackageName();
+ }
+
+ private void showNotification(Context context, int resId) {
+ final CharSequence message = context.getResources().getString(resId);
+ if (DEBUG) {
+ Log.d(TAG, "showNotification: message=" + message);
+ }
+
+ final Notification.Builder builder =
+ new Notification.Builder(mContext, NotificationChannels.ALERTS)
+ .setContentText(message)
+ .setStyle(new Notification.BigTextStyle())
+ .setSmallIcon(R.drawable.ic_info)
+ .setAutoCancel(true)
+ .setContentIntent(PendingIntent.getActivity(context, 0, new Intent(), 0));
+ context.getSystemService(NotificationManager.class).notify(TAG, 0, builder.build());
+ }
+
@Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.println("NavigationModeController:");
@@ -299,6 +396,12 @@
}
pw.println(" defaultOverlays=" + defaultOverlays);
dumpAssetPaths(mCurrentUserContext);
+
+ pw.println(" defaultLauncher=" + mLastDefaultLauncher);
+ boolean previouslySwitchedFromGestureNav = mCurrentUserContext
+ .getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE)
+ .getBoolean(PREFS_SWITCHED_FROM_GESTURE_NAV_KEY, false);
+ pw.println(" previouslySwitchedFromGestureNav=" + previouslySwitchedFromGestureNav);
}
private void dumpAssetPaths(Context context) {
@@ -308,27 +411,4 @@
Log.d(TAG, " " + a.getAssetPath());
}
}
-
- private void switchFromGestureNavModeIfNotSupportedByDefaultLauncher() {
- if (getCurrentInteractionMode(mCurrentUserContext) == NAV_BAR_MODE_GESTURAL
- && !isGestureNavSupportedByDefaultLauncher(mCurrentUserContext)) {
- setModeOverlay(NAV_BAR_MODE_3BUTTON_OVERLAY, USER_CURRENT);
- }
- }
-
- private boolean isGestureNavSupportedByDefaultLauncher(Context context) {
- final ComponentName cn = context.getPackageManager().getHomeActivities(new ArrayList<>());
- if (cn == null) {
- // There is no default home app set for the current user, don't make any changes yet.
- return true;
- }
- if (DEBUG) {
- Log.d(TAG, "isGestureNavSupportedByDefaultLauncher: launcher=" + cn.getPackageName()
- + " contextUser=" + context.getUserId());
- }
-
- ComponentName recentsComponentName = ComponentName.unflattenFromString(context.getString(
- com.android.internal.R.string.config_recentsComponentName));
- return recentsComponentName.getPackageName().equals(cn.getPackageName());
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 5fff054..80fbda0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -3222,8 +3222,7 @@
// Lock wallpaper defines the color of the majority of the views, hence we'll use it
// to set our default theme.
- final boolean lockDarkText = mColorExtractor.getColors(WallpaperManager.FLAG_LOCK, true
- /* ignoreVisibility */).supportsDarkText();
+ final boolean lockDarkText = mColorExtractor.getNeutralColors().supportsDarkText();
final int themeResId = lockDarkText ? R.style.Theme_SystemUI_Light : R.style.Theme_SystemUI;
if (mContext.getThemeResId() != themeResId) {
mContext.setTheme(themeResId);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
index 891bb35..c73ed60 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
@@ -25,7 +25,6 @@
import android.app.ActivityManager;
import android.app.IActivityManager;
-import android.app.WallpaperManager;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.res.Resources;
@@ -556,17 +555,7 @@
return;
}
- StatusBarStateController state = Dependency.get(StatusBarStateController.class);
- int which;
- if (state.getState() == StatusBarState.KEYGUARD
- || state.getState() == StatusBarState.SHADE_LOCKED) {
- which = WallpaperManager.FLAG_LOCK;
- } else {
- which = WallpaperManager.FLAG_SYSTEM;
- }
- final boolean useDarkText = mColorExtractor.getColors(which,
- true /* ignoreVisibility */).supportsDarkText();
-
+ final boolean useDarkText = mColorExtractor.getNeutralColors().supportsDarkText();
// Make sure we have the correct navbar/statusbar colors.
setKeyguardDark(useDarkText);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java b/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java
index 9c2c822..41747f4 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java
@@ -40,6 +40,7 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
/**
@@ -57,6 +58,8 @@
ColorExtractor.TYPE_DARK,
ColorExtractor.TYPE_EXTRA_DARK};
+ @Mock
+ private WallpaperManager mWallpaperManager;
private ColorExtractor.GradientColors mColors;
private SysuiColorExtractor mColorExtractor;
@@ -72,32 +75,15 @@
outGradientColorsNormal.set(mColors);
outGradientColorsDark.set(mColors);
outGradientColorsExtraDark.set(mColors);
- }, mock(ConfigurationController.class), false);
+ }, mock(ConfigurationController.class), mWallpaperManager, true /* immediately */);
}
@Test
- public void getColors_usesGreyIfWallpaperNotVisible() {
- simulateEvent(mColorExtractor);
- mColorExtractor.setWallpaperVisible(false);
-
- ColorExtractor.GradientColors fallbackColors = mColorExtractor.getNeutralColors();
-
- for (int type : sTypes) {
- assertEquals("Not using fallback!",
- mColorExtractor.getColors(WallpaperManager.FLAG_SYSTEM, type), fallbackColors);
- assertNotEquals("Wallpaper visibility event should not affect lock wallpaper.",
- mColorExtractor.getColors(WallpaperManager.FLAG_LOCK, type), fallbackColors);
- }
- }
-
- @Test
- public void getColors_doesntUseFallbackIfVisible() {
+ public void getColors() {
mColors.setMainColor(Color.RED);
mColors.setSecondaryColor(Color.RED);
simulateEvent(mColorExtractor);
- mColorExtractor.setWallpaperVisible(true);
-
for (int which : sWhich) {
for (int type : sTypes) {
assertEquals("Not using extracted colors!",
@@ -109,8 +95,7 @@
@Test
public void getColors_fallbackWhenMediaIsVisible() {
simulateEvent(mColorExtractor);
- mColorExtractor.setWallpaperVisible(true);
- mColorExtractor.setHasBackdrop(true);
+ mColorExtractor.setHasMediaArtwork(true);
ColorExtractor.GradientColors fallbackColors = mColorExtractor.getNeutralColors();
@@ -127,7 +112,7 @@
Tonal tonal = mock(Tonal.class);
ConfigurationController configurationController = mock(ConfigurationController.class);
SysuiColorExtractor sysuiColorExtractor = new SysuiColorExtractor(getContext(),
- tonal, configurationController, false /* registerVisibility */);
+ tonal, configurationController, mWallpaperManager, true /* immediately */);
verify(configurationController).addCallback(eq(sysuiColorExtractor));
reset(tonal);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java
index 025296d..06ff047 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java
@@ -101,7 +101,7 @@
mNotificationInflater.setUsesIncreasedHeadsUpHeight(true);
Notification.Builder builder = spy(mBuilder);
mNotificationInflater.inflateNotificationViews(
- false /* inflateSynchronously */,
+ true /* inflateSynchronously */,
FLAG_CONTENT_VIEW_ALL,
builder,
mContext);
@@ -113,7 +113,7 @@
mNotificationInflater.setUsesIncreasedHeight(true);
Notification.Builder builder = spy(mBuilder);
mNotificationInflater.inflateNotificationViews(
- false /* inflateSynchronously */,
+ true /* inflateSynchronously */,
FLAG_CONTENT_VIEW_ALL,
builder,
mContext);
@@ -161,6 +161,7 @@
@Test
public void testRemovedNotInflated() throws Exception {
mRow.setRemoved();
+ mNotificationInflater.setInflateSynchronously(true);
mNotificationInflater.inflateNotificationViews();
Assert.assertNull(mRow.getEntry().getRunningTask());
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
index 56265d0..d425982 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
@@ -70,6 +70,7 @@
import com.android.systemui.statusbar.notification.row.NotificationBlockingHelperManager;
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
+import com.android.systemui.statusbar.phone.NotificationIconAreaController;
import com.android.systemui.statusbar.phone.ScrimController;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBar;
@@ -110,6 +111,7 @@
@Mock private NotificationData mNotificationData;
@Mock private NotificationRemoteInputManager mRemoteInputManager;
@Mock private RemoteInputController mRemoteInputController;
+ @Mock private NotificationIconAreaController mNotificationIconAreaController;
@Mock private MetricsLogger mMetricsLogger;
@Mock private NotificationRoundnessManager mNotificationRoundnessManager;
private TestableNotificationEntryManager mEntryManager;
@@ -162,6 +164,7 @@
mStackScroller.setHeadsUpManager(mHeadsUpManager);
mStackScroller.setGroupManager(mGroupManager);
mStackScroller.setEmptyShadeView(mEmptyShadeView);
+ mStackScroller.setIconAreaController(mNotificationIconAreaController);
// Stub out functionality that isn't necessary to test.
doNothing().when(mBar)
diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java
index af9b0e2..3764ca4 100644
--- a/services/autofill/java/com/android/server/autofill/Session.java
+++ b/services/autofill/java/com/android/server/autofill/Session.java
@@ -569,12 +569,13 @@
@GuardedBy("mLock")
private void requestNewFillResponseLocked(@NonNull ViewState viewState, int newState,
int flags) {
- if (mForAugmentedAutofillOnly) {
+ if (mForAugmentedAutofillOnly || mRemoteFillService == null) {
if (sVerbose) {
Slog.v(TAG, "requestNewFillResponse(): triggering augmented autofill instead "
+ "(mForAugmentedAutofillOnly=" + mForAugmentedAutofillOnly
+ ", flags=" + flags + ")");
}
+ mForAugmentedAutofillOnly = true;
triggerAugmentedAutofillLocked();
return;
}
diff --git a/services/core/java/com/android/server/LocationManagerService.java b/services/core/java/com/android/server/LocationManagerService.java
index 78f0603..8a639c5 100644
--- a/services/core/java/com/android/server/LocationManagerService.java
+++ b/services/core/java/com/android/server/LocationManagerService.java
@@ -2361,7 +2361,7 @@
mRealRequest,
mReceiver.isListener(),
mReceiver.isPendingIntent(),
- /* radius= */ 0,
+ /* geofence= */ null,
mActivityManager.getPackageImportance(packageName));
// remove from mRecordsByProvider
@@ -2541,7 +2541,7 @@
LocationStatsEnums.USAGE_STARTED,
LocationStatsEnums.API_REQUEST_LOCATION_UPDATES,
packageName, request, listener != null, intent != null,
- /* radius= */ 0,
+ /* geofence= */ null,
mActivityManager.getPackageImportance(packageName));
Receiver receiver;
@@ -2844,7 +2844,7 @@
request,
/* hasListener= */ false,
intent != null,
- geofence.getRadius(),
+ geofence,
mActivityManager.getPackageImportance(packageName));
}
@@ -2876,7 +2876,7 @@
/* LocationRequest= */ null,
/* hasListener= */ false,
intent != null,
- geofence.getRadius(),
+ geofence,
mActivityManager.getPackageImportance(packageName));
}
mGeofenceManager.removeFence(geofence, intent);
@@ -2973,7 +2973,7 @@
/* LocationRequest= */ null,
/* hasListener= */ true,
/* hasIntent= */ false,
- /* radius */ 0,
+ /* geofence= */ null,
mActivityManager.getPackageImportance(packageName));
}
if (isThrottlingExemptLocked(callerIdentity)
@@ -3014,7 +3014,7 @@
/* LocationRequest= */ null,
/* hasListener= */ true,
/* hasIntent= */ false,
- /* radius= */ 0,
+ /* geofence= */ null,
mActivityManager.getPackageImportance(
linkedListener.mCallerIdentity.mPackageName));
}
diff --git a/services/core/java/com/android/server/LocationUsageLogger.java b/services/core/java/com/android/server/LocationUsageLogger.java
index c503035..4ca74bf 100644
--- a/services/core/java/com/android/server/LocationUsageLogger.java
+++ b/services/core/java/com/android/server/LocationUsageLogger.java
@@ -17,6 +17,7 @@
package com.android.server;
import android.app.ActivityManager;
+import android.location.Geofence;
import android.location.LocationManager;
import android.location.LocationRequest;
import android.os.SystemClock;
@@ -180,13 +181,14 @@
public void logLocationApiUsage(int usageType, int apiInUse,
String packageName, LocationRequest locationRequest,
boolean hasListener, boolean hasIntent,
- float radius, int activityImportance) {
+ Geofence geofence, int activityImportance) {
try {
if (!checkApiUsageLogCap()) {
return;
}
boolean isLocationRequestNull = locationRequest == null;
+ boolean isGeofenceNull = geofence == null;
if (D) {
Log.d(TAG, "log API Usage to statsd. usageType: " + usageType + ", apiInUse: "
+ apiInUse + ", packageName: " + (packageName == null ? "" : packageName)
@@ -194,7 +196,8 @@
+ (isLocationRequestNull ? "" : locationRequest.toString())
+ ", hasListener: " + hasListener
+ ", hasIntent: " + hasIntent
- + ", radius: " + radius
+ + ", geofence: "
+ + (isGeofenceNull ? "" : geofence.toString())
+ ", importance: " + activityImportance);
}
@@ -219,7 +222,9 @@
? LocationStatsEnums.EXPIRATION_UNKNOWN
: getBucketizedExpireIn(locationRequest.getExpireAt()),
getCallbackType(apiInUse, hasListener, hasIntent),
- bucketizeRadiusToStatsdEnum(radius),
+ isGeofenceNull
+ ? LocationStatsEnums.RADIUS_UNKNOWN
+ : bucketizeRadiusToStatsdEnum(geofence.getRadius()),
categorizeActivityImportance(activityImportance));
} catch (Exception e) {
// Swallow exceptions to avoid crashing LMS.
diff --git a/services/core/java/com/android/server/VibratorService.java b/services/core/java/com/android/server/VibratorService.java
index 0d19a67..6eb9f0c 100644
--- a/services/core/java/com/android/server/VibratorService.java
+++ b/services/core/java/com/android/server/VibratorService.java
@@ -620,7 +620,6 @@
linkVibration(vib);
long ident = Binder.clearCallingIdentity();
try {
-
doCancelVibrateLocked();
startVibrationLocked(vib);
addToPreviousVibrationsLocked(vib);
@@ -1437,6 +1436,8 @@
}
final class ExternalVibratorService extends IExternalVibratorService.Stub {
+ ExternalVibrationDeathRecipient mCurrentExternalDeathRecipient;
+
@Override
public int onExternalVibrationStart(ExternalVibration vib) {
if (!mSupportsExternalControl) {
@@ -1470,6 +1471,8 @@
// Note that this doesn't support multiple concurrent external controls, as we
// would need to mute the old one still if it came from a different controller.
mCurrentExternalVibration = vib;
+ mCurrentExternalDeathRecipient = new ExternalVibrationDeathRecipient();
+ mCurrentExternalVibration.linkToDeath(mCurrentExternalDeathRecipient);
if (mPreviousExternalVibrations.size() > mPreviousVibrationsLimit) {
mPreviousExternalVibrations.removeFirst();
}
@@ -1514,6 +1517,8 @@
public void onExternalVibrationStop(ExternalVibration vib) {
synchronized (mLock) {
if (vib.equals(mCurrentExternalVibration)) {
+ mCurrentExternalVibration.unlinkToDeath(mCurrentExternalDeathRecipient);
+ mCurrentExternalDeathRecipient = null;
mCurrentExternalVibration = null;
setVibratorUnderExternalControl(false);
if (DEBUG) {
@@ -1522,6 +1527,14 @@
}
}
}
+
+ private class ExternalVibrationDeathRecipient implements IBinder.DeathRecipient {
+ public void binderDied() {
+ synchronized (mLock) {
+ onExternalVibrationStop(mCurrentExternalVibration);
+ }
+ }
+ }
}
private final class VibratorShellCommand extends ShellCommand {
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index c5fc5c8..f14a3fd 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -547,6 +547,7 @@
private static final int MAX_BUGREPORT_TITLE_SIZE = 50;
private static final int NATIVE_DUMP_TIMEOUT_MS = 2000; // 2 seconds;
+ private static final int JAVA_DUMP_MINIMUM_SIZE = 100; // 100 bytes.
OomAdjuster mOomAdjuster;
final LowMemDetector mLowMemDetector;
@@ -3805,9 +3806,28 @@
*/
private static long dumpJavaTracesTombstoned(int pid, String fileName, long timeoutMs) {
final long timeStart = SystemClock.elapsedRealtime();
- if (!Debug.dumpJavaBacktraceToFileTimeout(pid, fileName, (int) (timeoutMs / 1000))) {
- Debug.dumpNativeBacktraceToFileTimeout(pid, fileName,
- (NATIVE_DUMP_TIMEOUT_MS / 1000));
+ boolean javaSuccess = Debug.dumpJavaBacktraceToFileTimeout(pid, fileName,
+ (int) (timeoutMs / 1000));
+ if (javaSuccess) {
+ // Check that something is in the file, actually. Try-catch should not be necessary,
+ // but better safe than sorry.
+ try {
+ long size = new File(fileName).length();
+ if (size < JAVA_DUMP_MINIMUM_SIZE) {
+ Slog.w(TAG, "Successfully created Java ANR file is empty!");
+ javaSuccess = false;
+ }
+ } catch (Exception e) {
+ Slog.w(TAG, "Unable to get ANR file size", e);
+ javaSuccess = false;
+ }
+ }
+ if (!javaSuccess) {
+ Slog.w(TAG, "Dumping Java threads failed, initiating native stack dump.");
+ if (!Debug.dumpNativeBacktraceToFileTimeout(pid, fileName,
+ (NATIVE_DUMP_TIMEOUT_MS / 1000))) {
+ Slog.w(TAG, "Native stack dump failed!");
+ }
}
return SystemClock.elapsedRealtime() - timeStart;
@@ -5375,34 +5395,13 @@
@Override
public void registerIntentSenderCancelListener(IIntentSender sender, IResultReceiver receiver) {
- if (!(sender instanceof PendingIntentRecord)) {
- return;
- }
- boolean isCancelled;
- synchronized(this) {
- PendingIntentRecord pendingIntent = (PendingIntentRecord) sender;
- isCancelled = pendingIntent.canceled;
- if (!isCancelled) {
- pendingIntent.registerCancelListenerLocked(receiver);
- }
- }
- if (isCancelled) {
- try {
- receiver.send(Activity.RESULT_CANCELED, null);
- } catch (RemoteException e) {
- }
- }
+ mPendingIntentController.registerIntentSenderCancelListener(sender, receiver);
}
@Override
public void unregisterIntentSenderCancelListener(IIntentSender sender,
IResultReceiver receiver) {
- if (!(sender instanceof PendingIntentRecord)) {
- return;
- }
- synchronized(this) {
- ((PendingIntentRecord)sender).unregisterCancelListenerLocked(receiver);
- }
+ mPendingIntentController.unregisterIntentSenderCancelListener(sender, receiver);
}
@Override
@@ -17679,13 +17678,8 @@
@Override
public void setPendingIntentWhitelistDuration(IIntentSender target, IBinder whitelistToken,
long duration) {
- if (!(target instanceof PendingIntentRecord)) {
- Slog.w(TAG, "markAsSentFromNotification(): not a PendingIntentRecord: " + target);
- return;
- }
- synchronized (ActivityManagerService.this) {
- ((PendingIntentRecord) target).setWhitelistDurationLocked(whitelistToken, duration);
- }
+ mPendingIntentController.setPendingIntentWhitelistDuration(target, whitelistToken,
+ duration);
}
@Override
diff --git a/services/core/java/com/android/server/am/BroadcastDispatcher.java b/services/core/java/com/android/server/am/BroadcastDispatcher.java
index d029482..f8a3d1e 100644
--- a/services/core/java/com/android/server/am/BroadcastDispatcher.java
+++ b/services/core/java/com/android/server/am/BroadcastDispatcher.java
@@ -725,6 +725,14 @@
final Dumper dumper = new Dumper(pw, queueName, dumpPackage, sdf);
boolean printed = false;
+ dumper.setHeading("Currently in flight");
+ dumper.setLabel("In-Flight Ordered Broadcast");
+ if (mCurrentBroadcast != null) {
+ dumper.dump(mCurrentBroadcast);
+ } else {
+ pw.println(" (null)");
+ }
+
dumper.setHeading("Active ordered broadcasts");
dumper.setLabel("Active Ordered Broadcast");
for (Deferrals d : mAlarmBroadcasts) {
diff --git a/services/core/java/com/android/server/am/PendingIntentController.java b/services/core/java/com/android/server/am/PendingIntentController.java
index a5d4738..d75591c 100644
--- a/services/core/java/com/android/server/am/PendingIntentController.java
+++ b/services/core/java/com/android/server/am/PendingIntentController.java
@@ -17,6 +17,7 @@
package com.android.server.am;
import static android.content.pm.PackageManager.MATCH_DEBUG_TRIAGED_MISSING;
+
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_MU;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_MU;
import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM;
@@ -39,6 +40,7 @@
import android.os.UserHandle;
import android.util.ArrayMap;
import android.util.Slog;
+
import com.android.internal.os.IResultReceiver;
import com.android.internal.util.function.pooled.PooledLambda;
import com.android.server.LocalServices;
@@ -242,6 +244,47 @@
}
}
+ void registerIntentSenderCancelListener(IIntentSender sender, IResultReceiver receiver) {
+ if (!(sender instanceof PendingIntentRecord)) {
+ return;
+ }
+ boolean isCancelled;
+ synchronized (mLock) {
+ PendingIntentRecord pendingIntent = (PendingIntentRecord) sender;
+ isCancelled = pendingIntent.canceled;
+ if (!isCancelled) {
+ pendingIntent.registerCancelListenerLocked(receiver);
+ }
+ }
+ if (isCancelled) {
+ try {
+ receiver.send(Activity.RESULT_CANCELED, null);
+ } catch (RemoteException e) {
+ }
+ }
+ }
+
+ void unregisterIntentSenderCancelListener(IIntentSender sender,
+ IResultReceiver receiver) {
+ if (!(sender instanceof PendingIntentRecord)) {
+ return;
+ }
+ synchronized (mLock) {
+ ((PendingIntentRecord) sender).unregisterCancelListenerLocked(receiver);
+ }
+ }
+
+ void setPendingIntentWhitelistDuration(IIntentSender target, IBinder whitelistToken,
+ long duration) {
+ if (!(target instanceof PendingIntentRecord)) {
+ Slog.w(TAG, "markAsSentFromNotification(): not a PendingIntentRecord: " + target);
+ return;
+ }
+ synchronized (mLock) {
+ ((PendingIntentRecord) target).setWhitelistDurationLocked(whitelistToken, duration);
+ }
+ }
+
private void makeIntentSenderCanceled(PendingIntentRecord rec) {
rec.canceled = true;
final RemoteCallbackList<IResultReceiver> callbacks = rec.detachCancelListenersLocked();
diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java
index 2399d05..b311233 100644
--- a/services/core/java/com/android/server/am/UserController.java
+++ b/services/core/java/com/android/server/am/UserController.java
@@ -559,7 +559,7 @@
// Spin up app widgets prior to boot-complete, so they can be ready promptly
mInjector.startUserWidgets(userId);
- Slog.i(TAG, "Sending BOOT_COMPLETE user #" + userId);
+ Slog.i(TAG, "Posting BOOT_COMPLETED user #" + userId);
// Do not report secondary users, runtime restarts or first boot/upgrade
if (userId == UserHandle.USER_SYSTEM
&& !mInjector.isRuntimeRestarted() && !mInjector.isFirstBootOrUpgrade()) {
@@ -572,18 +572,26 @@
bootIntent.addFlags(Intent.FLAG_RECEIVER_NO_ABORT
| Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND
| Intent.FLAG_RECEIVER_OFFLOAD);
- mInjector.broadcastIntent(bootIntent, null, new IIntentReceiver.Stub() {
- @Override
- public void performReceive(Intent intent, int resultCode, String data,
- Bundle extras, boolean ordered, boolean sticky, int sendingUser)
- throws RemoteException {
- Slog.i(UserController.TAG, "Finished processing BOOT_COMPLETED for u" + userId);
- mBootCompleted = true;
- }
- }, 0, null, null,
- new String[]{android.Manifest.permission.RECEIVE_BOOT_COMPLETED},
- AppOpsManager.OP_NONE, null, true, false, MY_PID, SYSTEM_UID,
- Binder.getCallingUid(), Binder.getCallingPid(), userId);
+ // Widget broadcasts are outbound via FgThread, so to guarantee sequencing
+ // we also send the boot_completed broadcast from that thread.
+ final int callingUid = Binder.getCallingUid();
+ final int callingPid = Binder.getCallingPid();
+ FgThread.getHandler().post(() -> {
+ mInjector.broadcastIntent(bootIntent, null,
+ new IIntentReceiver.Stub() {
+ @Override
+ public void performReceive(Intent intent, int resultCode, String data,
+ Bundle extras, boolean ordered, boolean sticky, int sendingUser)
+ throws RemoteException {
+ Slog.i(UserController.TAG, "Finished processing BOOT_COMPLETED for u"
+ + userId);
+ mBootCompleted = true;
+ }
+ }, 0, null, null,
+ new String[]{android.Manifest.permission.RECEIVE_BOOT_COMPLETED},
+ AppOpsManager.OP_NONE, null, true, false, MY_PID, SYSTEM_UID,
+ callingUid, callingPid, userId);
+ });
}
int restartUser(final int userId, final boolean foreground) {
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index e43c548..5ae5113 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -1016,6 +1016,7 @@
sendEncodedSurroundMode(mContentResolver, "onAudioServerDied");
sendEnabledSurroundFormats(mContentResolver, true);
updateAssistantUId(true);
+ updateRttEanbled(mContentResolver);
}
synchronized (mAccessibilityServiceUidsLock) {
AudioSystem.setA11yServicesUids(mAccessibilityServiceUids);
@@ -1480,6 +1481,12 @@
}
}
+ private void updateRttEanbled(ContentResolver cr) {
+ final boolean rttEnabled = Settings.Secure.getIntForUser(cr,
+ Settings.Secure.RTT_CALLING_MODE, 0, UserHandle.USER_CURRENT) != 0;
+ AudioSystem.setRttEnabled(rttEnabled);
+ }
+
private void readPersistedSettings() {
final ContentResolver cr = mContentResolver;
@@ -1524,6 +1531,7 @@
sendEncodedSurroundMode(cr, "readPersistedSettings");
sendEnabledSurroundFormats(cr, true);
updateAssistantUId(true);
+ updateRttEanbled(cr);
}
mMuteAffectedStreams = System.getIntForUser(cr,
@@ -5502,6 +5510,8 @@
mContentResolver.registerContentObserver(Settings.Secure.getUriFor(
Settings.Secure.VOICE_INTERACTION_SERVICE), false, this);
+ mContentResolver.registerContentObserver(Settings.Secure.getUriFor(
+ Settings.Secure.RTT_CALLING_MODE), false, this);
}
@Override
@@ -5525,6 +5535,7 @@
updateEncodedSurroundOutput();
sendEnabledSurroundFormats(mContentResolver, mSurroundModeChanged);
updateAssistantUId(false);
+ updateRttEanbled(mContentResolver);
}
}
diff --git a/services/core/java/com/android/server/location/GnssVisibilityControl.java b/services/core/java/com/android/server/location/GnssVisibilityControl.java
index 65bd5c6..3ee9419 100644
--- a/services/core/java/com/android/server/location/GnssVisibilityControl.java
+++ b/services/core/java/com/android/server/location/GnssVisibilityControl.java
@@ -78,7 +78,6 @@
private final Handler mHandler;
private final Context mContext;
private final GpsNetInitiatedHandler mNiHandler;
- private final Notification mEmergencyLocationUserNotification;
private boolean mIsGpsEnabled;
@@ -107,7 +106,6 @@
mNiHandler = niHandler;
mAppOps = mContext.getSystemService(AppOpsManager.class);
mPackageManager = mContext.getPackageManager();
- mEmergencyLocationUserNotification = createEmergencyLocationUserNotification(mContext);
// Complete initialization as the first event to run in mHandler thread. After that,
// all object state read/update events run in the mHandler thread.
@@ -632,13 +630,15 @@
}
notificationManager.notifyAsUser(/* tag= */ null, /* notificationId= */ 0,
- mEmergencyLocationUserNotification, UserHandle.ALL);
+ createEmergencyLocationUserNotification(mContext), UserHandle.ALL);
}
private static Notification createEmergencyLocationUserNotification(Context context) {
- String firstLineText = context.getString(R.string.gpsNotifTitle);
- String secondLineText = context.getString(R.string.global_action_emergency);
- String accessibilityServicesText = firstLineText + " (" + secondLineText + ")";
+ // NOTE: Do not reuse the returned notification object as it will not reflect
+ // changes to notification text when the system language is changed.
+ final String firstLineText = context.getString(R.string.gpsNotifTitle);
+ final String secondLineText = context.getString(R.string.global_action_emergency);
+ final String accessibilityServicesText = firstLineText + " (" + secondLineText + ")";
return new Notification.Builder(context, SystemNotificationChannels.NETWORK_ALERTS)
.setSmallIcon(com.android.internal.R.drawable.stat_sys_gps_on)
.setWhen(0)
diff --git a/services/core/java/com/android/server/oemlock/PersistentDataBlockLock.java b/services/core/java/com/android/server/oemlock/PersistentDataBlockLock.java
index a1c27d6..2474b2aa 100644
--- a/services/core/java/com/android/server/oemlock/PersistentDataBlockLock.java
+++ b/services/core/java/com/android/server/oemlock/PersistentDataBlockLock.java
@@ -73,6 +73,10 @@
// unlocked but doesn't actually do any unlocking.
final PersistentDataBlockManager pdbm = (PersistentDataBlockManager)
mContext.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
+ if (pdbm == null) {
+ Slog.w(TAG, "PersistentDataBlock is not supported on this device");
+ return;
+ }
pdbm.setOemUnlockEnabled(allowedByDevice);
}
@@ -80,6 +84,10 @@
boolean isOemUnlockAllowedByDevice() {
final PersistentDataBlockManager pdbm = (PersistentDataBlockManager)
mContext.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
+ if (pdbm == null) {
+ Slog.w(TAG, "PersistentDataBlock is not supported on this device");
+ return false;
+ }
return pdbm.getOemUnlockEnabled();
}
@@ -91,6 +99,10 @@
private void disallowUnlockIfNotUnlocked() {
final PersistentDataBlockManager pdbm = (PersistentDataBlockManager)
mContext.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
+ if (pdbm == null) {
+ Slog.w(TAG, "PersistentDataBlock is not supported on this device");
+ return;
+ }
if (pdbm.getFlashLockState() != PersistentDataBlockManager.FLASH_LOCK_UNLOCKED) {
pdbm.setOemUnlockEnabled(false);
}
diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java
index 5c55c2e..0a88eef 100644
--- a/services/core/java/com/android/server/wm/ActivityStarter.java
+++ b/services/core/java/com/android/server/wm/ActivityStarter.java
@@ -1419,6 +1419,13 @@
stack.finishActivityLocked(mStartActivity, RESULT_CANCELED,
null /* intentResultData */, "startActivity", true /* oomAdj */);
}
+
+ // Stack should also be detached from display and be removed if it's empty.
+ if (startedActivityStack != null && startedActivityStack.isAttached()
+ && startedActivityStack.numActivities() == 0
+ && !startedActivityStack.isActivityTypeHome()) {
+ startedActivityStack.remove();
+ }
}
mService.mWindowManager.continueSurfaceLayout();
}
@@ -2289,15 +2296,17 @@
}
private int setTaskFromReuseOrCreateNewTask(TaskRecord taskToAffiliate) {
+ if (mRestrictedBgActivity && (mReuseTask == null || !mReuseTask.containsAppUid(mCallingUid))
+ && handleBackgroundActivityAbort(mStartActivity)) {
+ return START_ABORTED;
+ }
+
mTargetStack = computeStackFocus(mStartActivity, true, mLaunchFlags, mOptions);
// Do no move the target stack to front yet, as we might bail if
// isLockTaskModeViolation fails below.
if (mReuseTask == null) {
- if (mRestrictedBgActivity && handleBackgroundActivityAbort(mStartActivity)) {
- return START_ABORTED;
- }
final TaskRecord task = mTargetStack.createTaskRecord(
mSupervisor.getNextTaskIdForUserLocked(mStartActivity.mUserId),
mNewTaskInfo != null ? mNewTaskInfo : mStartActivity.info,
@@ -2310,11 +2319,6 @@
if (DEBUG_TASKS) Slog.v(TAG_TASKS, "Starting new activity " + mStartActivity
+ " in new task " + mStartActivity.getTaskRecord());
} else {
- if (mRestrictedBgActivity && !mReuseTask.containsAppUid(mCallingUid)) {
- if (handleBackgroundActivityAbort(mStartActivity)) {
- return START_ABORTED;
- }
- }
addOrReparentStartingActivity(mReuseTask, "setTaskFromReuseOrCreateNewTask");
}
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index 4a9a3f7..60cfe14 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -540,6 +540,14 @@
// If the app was already visible, don't reset the waitingToShow state.
if (isHidden()) {
waitingToShow = true;
+
+ // Let's reset the draw state in order to prevent the starting window to be
+ // immediately dismissed when the app still has the surface.
+ forAllWindows(w -> {
+ if (w.mAttrs.type != TYPE_APPLICATION_STARTING) {
+ w.mWinAnimator.resetDrawState();
+ }
+ }, true /* traverseTopToBottom */);
}
}
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index de9d769..c6c9e1b 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -1548,7 +1548,8 @@
*/
boolean isInteresting() {
return mAppToken != null && !mAppDied
- && (!mAppToken.isFreezingScreen() || !mAppFreezing);
+ && (!mAppToken.isFreezingScreen() || !mAppFreezing)
+ && mViewVisibility == View.VISIBLE;
}
/**
diff --git a/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStore.aidl b/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStore.aidl
index 1e688d0..30893b2 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStore.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStore.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
interface IIpMemoryStore {
oneway void storeNetworkAttributes(String l2Key, in android.net.ipmemorystore.NetworkAttributesParcelable attributes, android.net.ipmemorystore.IOnStatusListener listener);
diff --git a/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStoreCallbacks.aidl b/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStoreCallbacks.aidl
index cf02c26..535ae2c 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStoreCallbacks.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStoreCallbacks.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
interface IIpMemoryStoreCallbacks {
oneway void onIpMemoryStoreFetched(in android.net.IIpMemoryStore ipMemoryStore);
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/Blob.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/Blob.aidl
index 291dbef..6d2dc0c 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/Blob.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/Blob.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ipmemorystore;
parcelable Blob {
byte[] data;
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl
index 52f40d4..48c1fb8 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ipmemorystore;
interface IOnBlobRetrievedListener {
oneway void onBlobRetrieved(in android.net.ipmemorystore.StatusParcelable status, in String l2Key, in String name, in android.net.ipmemorystore.Blob data);
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl
index 7853514..aebc724 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ipmemorystore;
interface IOnL2KeyResponseListener {
oneway void onL2KeyResponse(in android.net.ipmemorystore.StatusParcelable status, in String l2Key);
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl
index 3dd2ae6..b66db5a 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ipmemorystore;
interface IOnNetworkAttributesRetrievedListener {
oneway void onNetworkAttributesRetrieved(in android.net.ipmemorystore.StatusParcelable status, in String l2Key, in android.net.ipmemorystore.NetworkAttributesParcelable attributes);
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl
index 46d4ecb..e9f2db4 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ipmemorystore;
interface IOnSameL3NetworkResponseListener {
oneway void onSameL3NetworkResponse(in android.net.ipmemorystore.StatusParcelable status, in android.net.ipmemorystore.SameL3NetworkResponseParcelable response);
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnStatusListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnStatusListener.aidl
index 54e654b..49172ce 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnStatusListener.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnStatusListener.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ipmemorystore;
interface IOnStatusListener {
oneway void onComplete(in android.net.ipmemorystore.StatusParcelable status);
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/NetworkAttributesParcelable.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/NetworkAttributesParcelable.aidl
index 9531ea3..188db20 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/NetworkAttributesParcelable.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/NetworkAttributesParcelable.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ipmemorystore;
parcelable NetworkAttributesParcelable {
byte[] assignedV4Address;
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl
index 414272b..7a2ed48 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ipmemorystore;
parcelable SameL3NetworkResponseParcelable {
String l2Key1;
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/StatusParcelable.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/StatusParcelable.aidl
index 92c6779..d9b0678 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/StatusParcelable.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/StatusParcelable.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ipmemorystore;
parcelable StatusParcelable {
int resultCode;
diff --git a/services/net/aidl/networkstack/3/android/net/DhcpResultsParcelable.aidl b/services/net/aidl/networkstack/3/android/net/DhcpResultsParcelable.aidl
index 31891de..07ff321 100644
--- a/services/net/aidl/networkstack/3/android/net/DhcpResultsParcelable.aidl
+++ b/services/net/aidl/networkstack/3/android/net/DhcpResultsParcelable.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
parcelable DhcpResultsParcelable {
android.net.StaticIpConfiguration baseConfiguration;
diff --git a/services/net/aidl/networkstack/3/android/net/INetworkMonitor.aidl b/services/net/aidl/networkstack/3/android/net/INetworkMonitor.aidl
index 029968b..8aa68bd 100644
--- a/services/net/aidl/networkstack/3/android/net/INetworkMonitor.aidl
+++ b/services/net/aidl/networkstack/3/android/net/INetworkMonitor.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
interface INetworkMonitor {
oneway void start();
diff --git a/services/net/aidl/networkstack/3/android/net/INetworkMonitorCallbacks.aidl b/services/net/aidl/networkstack/3/android/net/INetworkMonitorCallbacks.aidl
index ee9871d..ea93729 100644
--- a/services/net/aidl/networkstack/3/android/net/INetworkMonitorCallbacks.aidl
+++ b/services/net/aidl/networkstack/3/android/net/INetworkMonitorCallbacks.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
interface INetworkMonitorCallbacks {
oneway void onNetworkMonitorCreated(in android.net.INetworkMonitor networkMonitor);
diff --git a/services/net/aidl/networkstack/3/android/net/INetworkStackConnector.aidl b/services/net/aidl/networkstack/3/android/net/INetworkStackConnector.aidl
index 7da11e4..e3a83d1 100644
--- a/services/net/aidl/networkstack/3/android/net/INetworkStackConnector.aidl
+++ b/services/net/aidl/networkstack/3/android/net/INetworkStackConnector.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
interface INetworkStackConnector {
oneway void makeDhcpServer(in String ifName, in android.net.dhcp.DhcpServingParamsParcel params, in android.net.dhcp.IDhcpServerCallbacks cb);
diff --git a/services/net/aidl/networkstack/3/android/net/INetworkStackStatusCallback.aidl b/services/net/aidl/networkstack/3/android/net/INetworkStackStatusCallback.aidl
index f6ca6f7..3112a08 100644
--- a/services/net/aidl/networkstack/3/android/net/INetworkStackStatusCallback.aidl
+++ b/services/net/aidl/networkstack/3/android/net/INetworkStackStatusCallback.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
interface INetworkStackStatusCallback {
oneway void onStatusAvailable(int statusCode);
diff --git a/services/net/aidl/networkstack/3/android/net/InitialConfigurationParcelable.aidl b/services/net/aidl/networkstack/3/android/net/InitialConfigurationParcelable.aidl
index c80a787..f846b26 100644
--- a/services/net/aidl/networkstack/3/android/net/InitialConfigurationParcelable.aidl
+++ b/services/net/aidl/networkstack/3/android/net/InitialConfigurationParcelable.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
parcelable InitialConfigurationParcelable {
android.net.LinkAddress[] ipAddresses;
diff --git a/services/net/aidl/networkstack/3/android/net/NattKeepalivePacketDataParcelable.aidl b/services/net/aidl/networkstack/3/android/net/NattKeepalivePacketDataParcelable.aidl
index 65de883..de75940 100644
--- a/services/net/aidl/networkstack/3/android/net/NattKeepalivePacketDataParcelable.aidl
+++ b/services/net/aidl/networkstack/3/android/net/NattKeepalivePacketDataParcelable.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
parcelable NattKeepalivePacketDataParcelable {
byte[] srcAddress;
diff --git a/services/net/aidl/networkstack/3/android/net/PrivateDnsConfigParcel.aidl b/services/net/aidl/networkstack/3/android/net/PrivateDnsConfigParcel.aidl
index 2de790b..cf0fbce9 100644
--- a/services/net/aidl/networkstack/3/android/net/PrivateDnsConfigParcel.aidl
+++ b/services/net/aidl/networkstack/3/android/net/PrivateDnsConfigParcel.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
parcelable PrivateDnsConfigParcel {
String hostname;
diff --git a/services/net/aidl/networkstack/3/android/net/ProvisioningConfigurationParcelable.aidl b/services/net/aidl/networkstack/3/android/net/ProvisioningConfigurationParcelable.aidl
index 3a6c304..c0f2d4d 100644
--- a/services/net/aidl/networkstack/3/android/net/ProvisioningConfigurationParcelable.aidl
+++ b/services/net/aidl/networkstack/3/android/net/ProvisioningConfigurationParcelable.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
parcelable ProvisioningConfigurationParcelable {
boolean enableIPv4;
diff --git a/services/net/aidl/networkstack/3/android/net/TcpKeepalivePacketDataParcelable.aidl b/services/net/aidl/networkstack/3/android/net/TcpKeepalivePacketDataParcelable.aidl
index e121c06..5926794 100644
--- a/services/net/aidl/networkstack/3/android/net/TcpKeepalivePacketDataParcelable.aidl
+++ b/services/net/aidl/networkstack/3/android/net/TcpKeepalivePacketDataParcelable.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
parcelable TcpKeepalivePacketDataParcelable {
byte[] srcAddress;
diff --git a/services/net/aidl/networkstack/3/android/net/dhcp/DhcpServingParamsParcel.aidl b/services/net/aidl/networkstack/3/android/net/dhcp/DhcpServingParamsParcel.aidl
index 67193ae..7ab156f 100644
--- a/services/net/aidl/networkstack/3/android/net/dhcp/DhcpServingParamsParcel.aidl
+++ b/services/net/aidl/networkstack/3/android/net/dhcp/DhcpServingParamsParcel.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.dhcp;
parcelable DhcpServingParamsParcel {
int serverAddr;
diff --git a/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServer.aidl b/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServer.aidl
index 9143158..d281ecf 100644
--- a/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServer.aidl
+++ b/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServer.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.dhcp;
interface IDhcpServer {
oneway void start(in android.net.INetworkStackStatusCallback cb);
diff --git a/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServerCallbacks.aidl b/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServerCallbacks.aidl
index dcc4489..98be0ab 100644
--- a/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServerCallbacks.aidl
+++ b/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServerCallbacks.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.dhcp;
interface IDhcpServerCallbacks {
oneway void onDhcpServerCreated(int statusCode, in android.net.dhcp.IDhcpServer server);
diff --git a/services/net/aidl/networkstack/3/android/net/ip/IIpClient.aidl b/services/net/aidl/networkstack/3/android/net/ip/IIpClient.aidl
index 176a5ce..85c8676 100644
--- a/services/net/aidl/networkstack/3/android/net/ip/IIpClient.aidl
+++ b/services/net/aidl/networkstack/3/android/net/ip/IIpClient.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ip;
interface IIpClient {
oneway void completedPreDhcpAction();
diff --git a/services/net/aidl/networkstack/3/android/net/ip/IIpClientCallbacks.aidl b/services/net/aidl/networkstack/3/android/net/ip/IIpClientCallbacks.aidl
index d6bc808..7fe39ed 100644
--- a/services/net/aidl/networkstack/3/android/net/ip/IIpClientCallbacks.aidl
+++ b/services/net/aidl/networkstack/3/android/net/ip/IIpClientCallbacks.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ip;
interface IIpClientCallbacks {
oneway void onIpClientCreated(in android.net.ip.IIpClient ipClient);
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java b/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java
index 53b0add..4986a6d 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java
@@ -585,7 +585,10 @@
}
void tearDown() {
- mHandlerThread.quitSafely();
+ // Make sure there are no running messages and then quit the thread so the next test
+ // won't be affected.
+ mHandlerThread.getThreadHandler().runWithScissors(mHandlerThread::quit,
+ 0 /* timeout */);
}
}
@@ -630,7 +633,8 @@
mWindowManager = prepareMockWindowManager();
mKeyguardController = mock(KeyguardController.class);
- // Do not schedule idle timeouts
+ // Do not schedule idle that may touch methods outside the scope of the test.
+ doNothing().when(this).scheduleIdleLocked();
doNothing().when(this).scheduleIdleTimeoutLocked(any());
// unit test version does not handle launch wake lock
doNothing().when(this).acquireLaunchWakelock();
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java
index 5d39a2c..518da74 100644
--- a/telephony/java/android/telephony/ServiceState.java
+++ b/telephony/java/android/telephony/ServiceState.java
@@ -16,6 +16,8 @@
package android.telephony;
+import static android.telephony.TelephonyManager.NETWORK_TYPE_BITMASK_UNKNOWN;
+
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -1605,6 +1607,12 @@
}
}
+ /** @hide */
+ public static int networkTypeToAccessNetworkType(@TelephonyManager.NetworkType
+ int networkType) {
+ return rilRadioTechnologyToAccessNetworkType(networkTypeToRilRadioTechnology(networkType));
+ }
+
/**
* Get current data network type.
*
@@ -1730,6 +1738,36 @@
return false;
}
+ /**
+ *
+ * Returns whether the bearerBitmask includes a networkType that matches the accessNetworkType.
+ *
+ * The NetworkType refers to NetworkType in TelephonyManager. For example
+ * {@link TelephonyManager#NETWORK_TYPE_GPRS}.
+ *
+ * The accessNetworkType refers to {@link AccessNetworkType}.
+ *
+ * @hide
+ * */
+ public static boolean networkBitmaskHasAccessNetworkType(
+ @TelephonyManager.NetworkTypeBitMask int networkBitmask, int accessNetworkType) {
+ if (networkBitmask == NETWORK_TYPE_BITMASK_UNKNOWN) return true;
+ if (accessNetworkType == AccessNetworkType.UNKNOWN) return false;
+
+ int networkType = 1;
+ while (networkBitmask != 0) {
+ if ((networkBitmask & 1) != 0) {
+ if (networkTypeToAccessNetworkType(networkType) == accessNetworkType) {
+ return true;
+ }
+ }
+ networkBitmask = networkBitmask >> 1;
+ networkType++;
+ }
+
+ return false;
+ }
+
/** @hide */
public static int getBitmaskForTech(int radioTech) {
if (radioTech >= 1) {
diff --git a/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java b/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java
index 17fa931..45ddc3e 100644
--- a/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java
+++ b/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java
@@ -39,6 +39,8 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
/**
* Tests color extraction generation.
@@ -48,16 +50,19 @@
public class ColorExtractorTest {
Context mContext;
+ @Mock
+ WallpaperManager mWallpaperManager;
@Before
public void setup() {
+ MockitoAnnotations.initMocks(this);
mContext = InstrumentationRegistry.getContext();
}
@Test
public void ColorExtractor_extractWhenInitialized() {
ExtractionType type = mock(Tonal.class);
- new ColorExtractor(mContext, type, true);
+ new ColorExtractor(mContext, type, true, mWallpaperManager);
// 1 for lock and 1 for system
verify(type, times(2))
.extractInto(any(), any(), any(), any());
@@ -84,7 +89,7 @@
outGradientColorsDark.set(colorsExpectedDark);
outGradientColorsExtraDark.set(colorsExpectedExtraDark);
};
- ColorExtractor extractor = new ColorExtractor(mContext, type, true);
+ ColorExtractor extractor = new ColorExtractor(mContext, type, true, mWallpaperManager);
GradientColors colors = extractor.getColors(WallpaperManager.FLAG_SYSTEM,
ColorExtractor.TYPE_NORMAL);
@@ -99,7 +104,8 @@
public void addOnColorsChangedListener_invokesListener() {
ColorExtractor.OnColorsChangedListener mockedListeners =
mock(ColorExtractor.OnColorsChangedListener.class);
- ColorExtractor extractor = new ColorExtractor(mContext, new Tonal(mContext), true);
+ ColorExtractor extractor = new ColorExtractor(mContext, new Tonal(mContext), true,
+ mWallpaperManager);
extractor.addOnColorsChangedListener(mockedListeners);
extractor.onColorsChanged(new WallpaperColors(Color.valueOf(Color.RED), null, null),