Merge "Logs biometric authentication error type." into qt-dev
diff --git a/api/test-current.txt b/api/test-current.txt
index 0de0d75..b1ffbad 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -3171,6 +3171,7 @@
@UiThread public class View implements android.view.accessibility.AccessibilityEventSource android.graphics.drawable.Drawable.Callback android.view.KeyEvent.Callback {
method public android.view.View getTooltipView();
+ method public boolean isAutofilled();
method public static boolean isDefaultFocusHighlightEnabled();
method public boolean isDefaultFocusHighlightNeeded(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable);
method protected void resetResolvedDrawables();
diff --git a/core/java/android/bluetooth/le/ScanFilter.java b/core/java/android/bluetooth/le/ScanFilter.java
index 07ba2c6..038994f 100644
--- a/core/java/android/bluetooth/le/ScanFilter.java
+++ b/core/java/android/bluetooth/le/ScanFilter.java
@@ -590,6 +590,9 @@
public @NonNull Builder setServiceSolicitationUuid(
@Nullable ParcelUuid serviceSolicitationUuid) {
mServiceSolicitationUuid = serviceSolicitationUuid;
+ if (serviceSolicitationUuid == null) {
+ mServiceSolicitationUuidMask = null;
+ }
return this;
}
@@ -600,13 +603,16 @@
* indicate a match is needed for the bit in {@code serviceSolicitationUuid}, and 0 to
* ignore that bit.
*
+ * @param serviceSolicitationUuid can only be null if solicitationUuidMask is null.
+ * @param solicitationUuidMask can be null or a mask with no restriction.
+ *
* @throws IllegalArgumentException If {@code serviceSolicitationUuid} is {@code null} but
* {@code serviceSolicitationUuidMask} is not {@code null}.
*/
public @NonNull Builder setServiceSolicitationUuid(
@Nullable ParcelUuid serviceSolicitationUuid,
@Nullable ParcelUuid solicitationUuidMask) {
- if (mServiceSolicitationUuidMask != null && mServiceSolicitationUuid == null) {
+ if (solicitationUuidMask != null && serviceSolicitationUuid == null) {
throw new IllegalArgumentException(
"SolicitationUuid is null while SolicitationUuidMask is not null!");
}
diff --git a/core/java/android/service/autofill/augmented/AugmentedAutofillService.java b/core/java/android/service/autofill/augmented/AugmentedAutofillService.java
index 87e369f..66c3e19 100644
--- a/core/java/android/service/autofill/augmented/AugmentedAutofillService.java
+++ b/core/java/android/service/autofill/augmented/AugmentedAutofillService.java
@@ -228,7 +228,7 @@
} else {
// TODO(b/123099468): figure out if it's ok to reuse the proxy; add logging
if (sDebug) Log.d(TAG, "Reusing proxy for session " + sessionId);
- proxy.update(focusedId, focusedValue, callback);
+ proxy.update(focusedId, focusedValue, callback, cancellationSignal);
}
try {
@@ -252,6 +252,15 @@
Log.w(TAG, "No proxy for session " + sessionId);
return;
}
+ if (proxy.mCallback != null) {
+ try {
+ if (!proxy.mCallback.isCompleted()) {
+ proxy.mCallback.cancel();
+ }
+ } catch (Exception e) {
+ Log.e(TAG, "failed to check current pending request status", e);
+ }
+ }
proxy.destroy();
}
mAutofillProxies.clear();
@@ -442,7 +451,7 @@
}
private void update(@NonNull AutofillId focusedId, @NonNull AutofillValue focusedValue,
- @NonNull IFillCallback callback) {
+ @NonNull IFillCallback callback, @NonNull CancellationSignal cancellationSignal) {
synchronized (mLock) {
mFocusedId = focusedId;
mFocusedValue = focusedValue;
@@ -457,6 +466,7 @@
Log.d(TAG, "mCallback is updated.");
}
mCallback = callback;
+ mCancellationSignal = cancellationSignal;
}
}
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 779c75f..bf6191e 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -8852,6 +8852,7 @@
/**
* @hide
*/
+ @TestApi
public boolean isAutofilled() {
return (mPrivateFlags3 & PFLAG3_IS_AUTOFILLED) != 0;
}
@@ -21508,23 +21509,27 @@
}
saveCount = canvas.getSaveCount();
+ int topSaveCount = -1;
+ int bottomSaveCount = -1;
+ int leftSaveCount = -1;
+ int rightSaveCount = -1;
int solidColor = getSolidColor();
if (solidColor == 0) {
if (drawTop) {
- canvas.saveUnclippedLayer(left, top, right, top + length);
+ topSaveCount = canvas.saveUnclippedLayer(left, top, right, top + length);
}
if (drawBottom) {
- canvas.saveUnclippedLayer(left, bottom - length, right, bottom);
+ bottomSaveCount = canvas.saveUnclippedLayer(left, bottom - length, right, bottom);
}
if (drawLeft) {
- canvas.saveUnclippedLayer(left, top, left + length, bottom);
+ leftSaveCount = canvas.saveUnclippedLayer(left, top, left + length, bottom);
}
if (drawRight) {
- canvas.saveUnclippedLayer(right - length, top, right, bottom);
+ rightSaveCount = canvas.saveUnclippedLayer(right - length, top, right, bottom);
}
} else {
scrollabilityCache.setFadeColor(solidColor);
@@ -21541,21 +21546,19 @@
final Matrix matrix = scrollabilityCache.matrix;
final Shader fade = scrollabilityCache.shader;
- if (drawTop) {
- matrix.setScale(1, fadeHeight * topFadeStrength);
- matrix.postTranslate(left, top);
+ // must be restored in the reverse order that they were saved
+ if (drawRight) {
+ matrix.setScale(1, fadeHeight * rightFadeStrength);
+ matrix.postRotate(90);
+ matrix.postTranslate(right, top);
fade.setLocalMatrix(matrix);
p.setShader(fade);
- canvas.drawRect(left, top, right, top + length, p);
- }
+ if (solidColor == 0) {
+ canvas.restoreUnclippedLayer(rightSaveCount, p);
- if (drawBottom) {
- matrix.setScale(1, fadeHeight * bottomFadeStrength);
- matrix.postRotate(180);
- matrix.postTranslate(left, bottom);
- fade.setLocalMatrix(matrix);
- p.setShader(fade);
- canvas.drawRect(left, bottom - length, right, bottom, p);
+ } else {
+ canvas.drawRect(right - length, top, right, bottom, p);
+ }
}
if (drawLeft) {
@@ -21564,16 +21567,36 @@
matrix.postTranslate(left, top);
fade.setLocalMatrix(matrix);
p.setShader(fade);
- canvas.drawRect(left, top, left + length, bottom, p);
+ if (solidColor == 0) {
+ canvas.restoreUnclippedLayer(leftSaveCount, p);
+ } else {
+ canvas.drawRect(left, top, left + length, bottom, p);
+ }
}
- if (drawRight) {
- matrix.setScale(1, fadeHeight * rightFadeStrength);
- matrix.postRotate(90);
- matrix.postTranslate(right, top);
+ if (drawBottom) {
+ matrix.setScale(1, fadeHeight * bottomFadeStrength);
+ matrix.postRotate(180);
+ matrix.postTranslate(left, bottom);
fade.setLocalMatrix(matrix);
p.setShader(fade);
- canvas.drawRect(right - length, top, right, bottom, p);
+ if (solidColor == 0) {
+ canvas.restoreUnclippedLayer(bottomSaveCount, p);
+ } else {
+ canvas.drawRect(left, bottom - length, right, bottom, p);
+ }
+ }
+
+ if (drawTop) {
+ matrix.setScale(1, fadeHeight * topFadeStrength);
+ matrix.postTranslate(left, top);
+ fade.setLocalMatrix(matrix);
+ p.setShader(fade);
+ if (solidColor == 0) {
+ canvas.restoreUnclippedLayer(topSaveCount, p);
+ } else {
+ canvas.drawRect(left, top, right, top + length, p);
+ }
}
canvas.restoreToCount(saveCount);
diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java
index c36b894..1f7ae0e 100644
--- a/core/java/android/view/autofill/AutofillManager.java
+++ b/core/java/android/view/autofill/AutofillManager.java
@@ -1204,10 +1204,6 @@
AutofillValue value = null;
synchronized (mLock) {
- if (mForAugmentedAutofillOnly) {
- if (sVerbose) Log.v(TAG, "notifyValueChanged(): ignoring on augmented only mode");
- return;
- }
// If the session is gone some fields might still be highlighted, hence we have to
// remove the isAutofilled property even if no sessions are active.
if (mLastAutofilledData == null) {
@@ -1229,6 +1225,13 @@
}
}
+ if (mForAugmentedAutofillOnly) {
+ if (sVerbose) {
+ Log.v(TAG, "notifyValueChanged(): not notifying system server on "
+ + "augmented-only mode");
+ }
+ return;
+ }
if (!mEnabled || !isActiveLocked()) {
if (sVerbose) {
Log.v(TAG, "notifyValueChanged(" + view.getAutofillId()
diff --git a/core/jni/android_graphics_Canvas.cpp b/core/jni/android_graphics_Canvas.cpp
index 7a8c5c8..ebc6cd7 100644
--- a/core/jni/android_graphics_Canvas.cpp
+++ b/core/jni/android_graphics_Canvas.cpp
@@ -106,6 +106,11 @@
return reinterpret_cast<jint>(get_canvas(canvasHandle)->saveUnclippedLayer(l, t, r, b));
}
+static void restoreUnclippedLayer(jlong canvasHandle, jint saveCount, jlong paintHandle) {
+ Paint* paint = reinterpret_cast<Paint*>(paintHandle);
+ get_canvas(canvasHandle)->restoreUnclippedLayer(saveCount, *paint);
+}
+
static bool restore(jlong canvasHandle) {
Canvas* canvas = get_canvas(canvasHandle);
if (canvas->getSaveCount() <= 1) {
@@ -668,6 +673,7 @@
{"nSaveLayer","(JFFFFJI)I", (void*) CanvasJNI::saveLayer},
{"nSaveLayerAlpha","(JFFFFII)I", (void*) CanvasJNI::saveLayerAlpha},
{"nSaveUnclippedLayer","(JIIII)I", (void*) CanvasJNI::saveUnclippedLayer},
+ {"nRestoreUnclippedLayer","(JIJ)V", (void*) CanvasJNI::restoreUnclippedLayer},
{"nGetSaveCount","(J)I", (void*) CanvasJNI::getSaveCount},
{"nRestore","(J)Z", (void*) CanvasJNI::restore},
{"nRestoreToCount","(JI)V", (void*) CanvasJNI::restoreToCount},
diff --git a/core/res/res/values/colors_device_defaults.xml b/core/res/res/values/colors_device_defaults.xml
index 6225896..7a8f411 100644
--- a/core/res/res/values/colors_device_defaults.xml
+++ b/core/res/res/values/colors_device_defaults.xml
@@ -50,9 +50,10 @@
<color name="list_divider_color_dark">#85ffffff</color>
<color name="list_divider_opacity_device_default_light">@android:color/white</color>
<color name="list_divider_opacity_device_default_dark">@android:color/white</color>
- <color name="loading_gradient_background_color_dark">#2D3033</color>
- <color name="loading_gradient_background_color_light">#DADCE0</color>
- <color name="loading_gradient_highlight_color_dark">#3C4043</color>
+
+ <color name="loading_gradient_background_color_dark">#44484C</color>
+ <color name="loading_gradient_background_color_light">#F8F9FA</color>
+ <color name="loading_gradient_highlight_color_dark">#4D5155</color>
<color name="loading_gradient_highlight_color_light">#F1F3F4</color>
<color name="edge_effect_device_default_light">@android:color/black</color>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 0daebd7..2de5397 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -3457,7 +3457,7 @@
<!-- Flag indicating whether the assist disclosure can be disabled using
ASSIST_DISCLOSURE_ENABLED. -->
- <bool name="config_allowDisablingAssistDisclosure">false</bool>
+ <bool name="config_allowDisablingAssistDisclosure">true</bool>
<!-- True if the device supports system navigation keys. -->
<bool name="config_supportSystemNavigationKeys">false</bool>
diff --git a/core/res/res/values/locale_config.xml b/core/res/res/values/locale_config.xml
index d6c0a10..3c65caf 100644
--- a/core/res/res/values/locale_config.xml
+++ b/core/res/res/values/locale_config.xml
@@ -78,6 +78,7 @@
<item>ar-YE</item> <!-- Arabic (Yemen) -->
<item>ar-YE-u-nu-latn</item> <!-- Arabic (Yemen, Western Digits) -->
<item>as-IN</item> <!-- Assamese (India) -->
+ <item>as-IN-u-nu-latn</item> <!-- Assamese (India, Western Digits) -->
<item>asa-TZ</item> <!-- Asu (Tanzania) -->
<item>ast-ES</item> <!-- Asturian (Spain) -->
<item>az-Cyrl-AZ</item> <!-- Azerbaijani (Cyrillic, Azerbaijan) -->
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index d4d5ae7..5648b85 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -559,6 +559,16 @@
}
/**
+ * @hide
+ * @param saveCount The save level to restore to.
+ * @param paint This is copied and is applied to the area within the unclipped layer's
+ * bounds (i.e. equivalent to a drawPaint()) before restore() is called.
+ */
+ public void restoreUnclippedLayer(int saveCount, Paint paint) {
+ nRestoreUnclippedLayer(mNativeCanvasWrapper, saveCount, paint.getNativeInstance());
+ }
+
+ /**
* Helper version of saveLayer() that takes 4 values rather than a RectF.
*
* As of API Level API level {@value Build.VERSION_CODES#P} the only valid
@@ -1398,6 +1408,9 @@
@CriticalNative
private static native int nSaveUnclippedLayer(long nativeCanvas, int l, int t, int r, int b);
@CriticalNative
+ private static native void nRestoreUnclippedLayer(long nativeCanvas, int saveCount,
+ long nativePaint);
+ @CriticalNative
private static native boolean nRestore(long canvasHandle);
@CriticalNative
private static native void nRestoreToCount(long canvasHandle, int saveCount);
diff --git a/libs/hwui/DisplayListOps.in b/libs/hwui/DisplayListOps.in
index 14e3a32..2deb565 100644
--- a/libs/hwui/DisplayListOps.in
+++ b/libs/hwui/DisplayListOps.in
@@ -26,7 +26,8 @@
X(ClipRect)
X(ClipRRect)
X(ClipRegion)
-X(DrawPaint)
+X(DrawPaint)
+X(DrawBehind)
X(DrawPath)
X(DrawRect)
X(DrawRegion)
diff --git a/libs/hwui/RecordingCanvas.cpp b/libs/hwui/RecordingCanvas.cpp
index 8594766..e58fbbe 100644
--- a/libs/hwui/RecordingCanvas.cpp
+++ b/libs/hwui/RecordingCanvas.cpp
@@ -20,6 +20,7 @@
#include "SkAndroidFrameworkUtils.h"
#include "SkCanvas.h"
+#include "SkCanvasPriv.h"
#include "SkData.h"
#include "SkDrawShadowInfo.h"
#include "SkImage.h"
@@ -187,6 +188,12 @@
SkPaint paint;
void draw(SkCanvas* c, const SkMatrix&) const { c->drawPaint(paint); }
};
+struct DrawBehind final : Op {
+ static const auto kType = Type::DrawBehind;
+ DrawBehind(const SkPaint& paint) : paint(paint) {}
+ SkPaint paint;
+ void draw(SkCanvas* c, const SkMatrix&) const { SkCanvasPriv::DrawBehind(c, paint); }
+};
struct DrawPath final : Op {
static const auto kType = Type::DrawPath;
DrawPath(const SkPath& path, const SkPaint& paint) : path(path), paint(paint) {}
@@ -565,6 +572,9 @@
void DisplayListData::drawPaint(const SkPaint& paint) {
this->push<DrawPaint>(0, paint);
}
+void DisplayListData::drawBehind(const SkPaint& paint) {
+ this->push<DrawBehind>(0, paint);
+}
void DisplayListData::drawPath(const SkPath& path, const SkPaint& paint) {
this->push<DrawPath>(0, path, paint);
}
@@ -834,6 +844,9 @@
void RecordingCanvas::onDrawPaint(const SkPaint& paint) {
fDL->drawPaint(paint);
}
+void RecordingCanvas::onDrawBehind(const SkPaint& paint) {
+ fDL->drawBehind(paint);
+}
void RecordingCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
fDL->drawPath(path, paint);
}
diff --git a/libs/hwui/RecordingCanvas.h b/libs/hwui/RecordingCanvas.h
index 3a76ca1..7269bca 100644
--- a/libs/hwui/RecordingCanvas.h
+++ b/libs/hwui/RecordingCanvas.h
@@ -89,6 +89,7 @@
void clipRegion(const SkRegion&, SkClipOp);
void drawPaint(const SkPaint&);
+ void drawBehind(const SkPaint&);
void drawPath(const SkPath&, const SkPaint&);
void drawRect(const SkRect&, const SkPaint&);
void drawRegion(const SkRegion&, const SkPaint&);
@@ -157,6 +158,7 @@
void onClipRegion(const SkRegion&, SkClipOp) override;
void onDrawPaint(const SkPaint&) override;
+ void onDrawBehind(const SkPaint&) override;
void onDrawPath(const SkPath&, const SkPaint&) override;
void onDrawRect(const SkRect&, const SkPaint&) override;
void onDrawRegion(const SkRegion&, const SkPaint&) override;
diff --git a/libs/hwui/SkiaCanvas.cpp b/libs/hwui/SkiaCanvas.cpp
index f328a53..bebda85 100644
--- a/libs/hwui/SkiaCanvas.cpp
+++ b/libs/hwui/SkiaCanvas.cpp
@@ -26,6 +26,7 @@
#include <SkAndroidFrameworkUtils.h>
#include <SkAnimatedImage.h>
+#include <SkCanvasPriv.h>
#include <SkCanvasStateUtils.h>
#include <SkColorFilter.h>
#include <SkDeque.h>
@@ -191,6 +192,18 @@
return SkAndroidFrameworkUtils::SaveBehind(mCanvas, &bounds);
}
+void SkiaCanvas::restoreUnclippedLayer(int restoreCount, const SkPaint& paint) {
+
+ while (mCanvas->getSaveCount() > restoreCount + 1) {
+ this->restore();
+ }
+
+ if (mCanvas->getSaveCount() == restoreCount + 1) {
+ SkCanvasPriv::DrawBehind(mCanvas, *filterPaint(paint));
+ this->restore();
+ }
+}
+
class SkiaCanvas::Clip {
public:
Clip(const SkRect& rect, SkClipOp op, const SkMatrix& m)
diff --git a/libs/hwui/SkiaCanvas.h b/libs/hwui/SkiaCanvas.h
index 3fe2bce..bbe91eb 100644
--- a/libs/hwui/SkiaCanvas.h
+++ b/libs/hwui/SkiaCanvas.h
@@ -69,6 +69,7 @@
virtual int save(SaveFlags::Flags flags) override;
virtual void restore() override;
virtual void restoreToCount(int saveCount) override;
+ virtual void restoreUnclippedLayer(int saveCount, const SkPaint& paint) override;
virtual int saveLayer(float left, float top, float right, float bottom, const SkPaint* paint,
SaveFlags::Flags flags) override;
diff --git a/libs/hwui/hwui/Canvas.h b/libs/hwui/hwui/Canvas.h
index 11e8579..ac8db21 100644
--- a/libs/hwui/hwui/Canvas.h
+++ b/libs/hwui/hwui/Canvas.h
@@ -191,6 +191,7 @@
virtual int save(SaveFlags::Flags flags) = 0;
virtual void restore() = 0;
virtual void restoreToCount(int saveCount) = 0;
+ virtual void restoreUnclippedLayer(int saveCount, const SkPaint& paint) = 0;
virtual int saveLayer(float left, float top, float right, float bottom, const SkPaint* paint,
SaveFlags::Flags flags) = 0;
diff --git a/libs/hwui/pipeline/skia/SkiaPipeline.cpp b/libs/hwui/pipeline/skia/SkiaPipeline.cpp
index ccc1701..1f9ab5a 100644
--- a/libs/hwui/pipeline/skia/SkiaPipeline.cpp
+++ b/libs/hwui/pipeline/skia/SkiaPipeline.cpp
@@ -176,7 +176,7 @@
// position
Matrix4 windowTransform;
damageAccumulator.computeCurrentTransform(&windowTransform);
- node->getSkiaLayer()->inverseTransformInWindow = windowTransform;
+ node->getSkiaLayer()->inverseTransformInWindow.loadInverse(windowTransform);
} else {
String8 cachesOutput;
mRenderThread.cacheManager().dumpMemoryUsage(cachesOutput,
diff --git a/packages/NetworkStack/src/com/android/server/NetworkStackService.java b/packages/NetworkStack/src/com/android/server/NetworkStackService.java
index c394d4c..2fae0c7 100644
--- a/packages/NetworkStack/src/com/android/server/NetworkStackService.java
+++ b/packages/NetworkStack/src/com/android/server/NetworkStackService.java
@@ -49,6 +49,7 @@
import android.net.util.SharedLog;
import android.os.IBinder;
import android.os.RemoteException;
+import android.util.ArraySet;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.util.IndentingPrintWriter;
@@ -62,7 +63,6 @@
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.concurrent.atomic.AtomicInteger;
/**
* Android service used to start the network stack when bound to via an intent.
@@ -118,14 +118,12 @@
@GuardedBy("mValidationLogs")
private final ArrayDeque<SharedLog> mValidationLogs = new ArrayDeque<>(MAX_VALIDATION_LOGS);
- private static final int VERSION_UNKNOWN = 0;
private static final String DUMPSYS_ARG_VERSION = "version";
- /** Version of the AIDL interfaces observed on the system */
- private final AtomicInteger mSystemAidlVersion = new AtomicInteger(VERSION_UNKNOWN);
-
- /** Whether different versions have been observed on interfaces provided by the system */
- private volatile boolean mConflictingSystemAidlVersions = false;
+ /** Version of the framework AIDL interfaces observed. Should hold only one value. */
+ @GuardedBy("mFrameworkAidlVersions")
+ private final ArraySet<Integer> mFrameworkAidlVersions = new ArraySet<>(1);
+ private final int mNetdAidlVersion;
private SharedLog addValidationLogs(Network network, String name) {
final SharedLog log = new SharedLog(NUM_VALIDATION_LOG_LINES, network + " - " + name);
@@ -146,6 +144,15 @@
mCm = context.getSystemService(ConnectivityManager.class);
mIpMemoryStoreService = new IpMemoryStoreService(context);
+ int netdVersion;
+ try {
+ netdVersion = mNetd.getInterfaceVersion();
+ } catch (RemoteException e) {
+ mLog.e("Error obtaining INetd version", e);
+ netdVersion = -1;
+ }
+ mNetdAidlVersion = netdVersion;
+
try {
mObserverRegistry.register(mNetd);
} catch (RemoteException e) {
@@ -154,9 +161,8 @@
}
private void updateSystemAidlVersion(final int version) {
- final int previousVersion = mSystemAidlVersion.getAndSet(version);
- if (previousVersion != VERSION_UNKNOWN && previousVersion != version) {
- mConflictingSystemAidlVersions = true;
+ synchronized (mFrameworkAidlVersions) {
+ mFrameworkAidlVersions.add(version);
}
}
@@ -230,12 +236,16 @@
protected void dump(@NonNull FileDescriptor fd, @NonNull PrintWriter fout,
@Nullable String[] args) {
checkDumpPermission();
+
+ final IndentingPrintWriter pw = new IndentingPrintWriter(fout, " ");
+ pw.println("NetworkStack version:");
+ dumpVersion(pw);
+ pw.println();
+
if (args != null && args.length >= 1 && DUMPSYS_ARG_VERSION.equals(args[0])) {
- dumpVersion(fout);
return;
}
- final IndentingPrintWriter pw = new IndentingPrintWriter(fout, " ");
pw.println("NetworkStack logs:");
mLog.dump(fd, pw, args);
@@ -283,8 +293,10 @@
*/
private void dumpVersion(@NonNull PrintWriter fout) {
fout.println("NetworkStackConnector: " + this.VERSION);
- fout.println("SystemServer: " + mSystemAidlVersion);
- fout.println("SystemServerConflicts: " + mConflictingSystemAidlVersions);
+ synchronized (mFrameworkAidlVersions) {
+ fout.println("SystemServer: " + mFrameworkAidlVersions);
+ }
+ fout.println("Netd: " + mNetdAidlVersion);
}
@Override
diff --git a/packages/SystemUI/res/drawable/corner_gesture_hint.xml b/packages/SystemUI/res/drawable/corner_gesture_hint.xml
new file mode 100644
index 0000000..3f4abb0
--- /dev/null
+++ b/packages/SystemUI/res/drawable/corner_gesture_hint.xml
@@ -0,0 +1,25 @@
+<!--
+ Copyright (C) 2019 The Android Open Source Project
+
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:height="12dp"
+ android:width="12dp"
+ android:viewportWidth="12"
+ android:viewportHeight="12">
+
+ <path android:fillColor="#00000000"
+ android:pathData="M 1.18 10.65 C 1.18 5.58 5.41 1.18 10.65 1.18"
+ android:strokeColor="#000"
+ android:strokeLineCap="round"
+ android:strokeWidth="1.3" />
+</vector>
diff --git a/packages/SystemUI/res/layout/rounded_corners.xml b/packages/SystemUI/res/layout/rounded_corners.xml
index 26cf792..02651a2 100644
--- a/packages/SystemUI/res/layout/rounded_corners.xml
+++ b/packages/SystemUI/res/layout/rounded_corners.xml
@@ -32,4 +32,22 @@
android:tint="#ff000000"
android:layout_gravity="right|bottom"
android:src="@drawable/rounded" />
+ <ImageView
+ android:id="@+id/assist_hint_left"
+ android:layout_width="32dp"
+ android:layout_height="32dp"
+ android:padding="6dp"
+ android:layout_gravity="left|top"
+ android:src="@drawable/corner_gesture_hint"
+ android:tint="#ffffffff"
+ android:visibility="gone" />
+ <ImageView
+ android:id="@+id/assist_hint_right"
+ android:layout_width="32dp"
+ android:layout_height="32dp"
+ android:padding="6dp"
+ android:layout_gravity="right|bottom"
+ android:src="@drawable/corner_gesture_hint"
+ android:tint="#ffffffff"
+ android:visibility="gone" />
</com.android.systemui.RegionInterceptingFrameLayout>
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 417cc68..6a4dbc8d 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -1187,7 +1187,7 @@
throw new IllegalArgumentException("only handles intent ACTION_SIM_STATE_CHANGED");
}
String stateExtra = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE);
- int slotId = intent.getIntExtra(PhoneConstants.SLOT_KEY, 0);
+ int slotId = intent.getIntExtra(PhoneConstants.PHONE_KEY, 0);
int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY,
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
if (IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(stateExtra)) {
diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
index c0f03a6..69d3af8 100644
--- a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
+++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
@@ -105,6 +105,7 @@
private float mDensity;
private WindowManager mWindowManager;
private int mRotation;
+ private boolean mAssistHintVisible;
private DisplayCutoutView mCutoutTop;
private DisplayCutoutView mCutoutBottom;
private SecureSetting mColorInversionSetting;
@@ -133,6 +134,55 @@
mHandler = startHandlerThread();
mHandler.post(this::startOnScreenDecorationsThread);
setupStatusBarPaddingIfNeeded();
+ putComponent(ScreenDecorations.class, this);
+ }
+
+ private void fade(View view, boolean fadeIn) {
+ if (fadeIn) {
+ view.animate().cancel();
+ view.setAlpha(0f);
+ view.setVisibility(View.VISIBLE);
+ view.animate().alpha(1f);
+ } else {
+ view.animate().cancel();
+ view.animate().alpha(0f).withEndAction(() -> view.setVisibility(View.INVISIBLE));
+ }
+
+ }
+
+ /**
+ * Controls the visibility of the assist gesture handles.
+ *
+ * @param visible whether the handles should be shown
+ */
+ public void setAssistHintVisible(boolean visible) {
+ if (mAssistHintVisible != visible) {
+ mAssistHintVisible = visible;
+
+ View assistHintTopLeft = mOverlay.findViewById(R.id.assist_hint_left);
+ View assistHintTopRight = mOverlay.findViewById(R.id.assist_hint_right);
+ View assistHintBottomLeft = mBottomOverlay.findViewById(R.id.assist_hint_left);
+ View assistHintBottomRight = mBottomOverlay.findViewById(R.id.assist_hint_right);
+
+ switch (mRotation) {
+ case RotationUtils.ROTATION_NONE:
+ fade(assistHintBottomLeft, mAssistHintVisible);
+ fade(assistHintBottomRight, mAssistHintVisible);
+ break;
+ case RotationUtils.ROTATION_LANDSCAPE:
+ fade(assistHintTopRight, mAssistHintVisible);
+ fade(assistHintBottomRight, mAssistHintVisible);
+ break;
+ case RotationUtils.ROTATION_SEASCAPE:
+ fade(assistHintTopLeft, mAssistHintVisible);
+ fade(assistHintBottomLeft, mAssistHintVisible);
+ break;
+ case RotationUtils.ROTATION_UPSIDE_DOWN:
+ fade(assistHintTopLeft, mAssistHintVisible);
+ fade(assistHintTopRight, mAssistHintVisible);
+ break;
+ }
+ }
}
@VisibleForTesting
@@ -375,12 +425,52 @@
updateView(bottomRight, Gravity.TOP | Gravity.LEFT, 0);
}
+ updateAssistantHandleViews();
mCutoutTop.setRotation(mRotation);
mCutoutBottom.setRotation(mRotation);
updateWindowVisibilities();
}
+ private void updateAssistantHandleViews() {
+ View assistHintTopLeft = mOverlay.findViewById(R.id.assist_hint_left);
+ View assistHintTopRight = mOverlay.findViewById(R.id.assist_hint_right);
+ View assistHintBottomLeft = mBottomOverlay.findViewById(R.id.assist_hint_left);
+ View assistHintBottomRight = mBottomOverlay.findViewById(R.id.assist_hint_right);
+
+ final int assistHintVisibility = mAssistHintVisible ? View.VISIBLE : View.INVISIBLE;
+
+ if (mRotation == RotationUtils.ROTATION_NONE) {
+ assistHintTopLeft.setVisibility(View.GONE);
+ assistHintTopRight.setVisibility(View.GONE);
+ assistHintBottomLeft.setVisibility(assistHintVisibility);
+ assistHintBottomRight.setVisibility(assistHintVisibility);
+ updateView(assistHintBottomLeft, Gravity.BOTTOM | Gravity.LEFT, 270);
+ updateView(assistHintBottomRight, Gravity.BOTTOM | Gravity.RIGHT, 180);
+ } else if (mRotation == RotationUtils.ROTATION_LANDSCAPE) {
+ assistHintTopLeft.setVisibility(View.GONE);
+ assistHintTopRight.setVisibility(assistHintVisibility);
+ assistHintBottomLeft.setVisibility(View.GONE);
+ assistHintBottomRight.setVisibility(assistHintVisibility);
+ updateView(assistHintTopRight, Gravity.BOTTOM | Gravity.LEFT, 270);
+ updateView(assistHintBottomRight, Gravity.BOTTOM | Gravity.RIGHT, 180);
+ } else if (mRotation == RotationUtils.ROTATION_UPSIDE_DOWN) {
+ assistHintTopLeft.setVisibility(assistHintVisibility);
+ assistHintTopRight.setVisibility(assistHintVisibility);
+ assistHintBottomLeft.setVisibility(View.GONE);
+ assistHintBottomRight.setVisibility(View.GONE);
+ updateView(assistHintTopLeft, Gravity.BOTTOM | Gravity.LEFT, 270);
+ updateView(assistHintTopRight, Gravity.BOTTOM | Gravity.RIGHT, 180);
+ } else if (mRotation == RotationUtils.ROTATION_SEASCAPE) {
+ assistHintTopLeft.setVisibility(assistHintVisibility);
+ assistHintTopRight.setVisibility(View.GONE);
+ assistHintBottomLeft.setVisibility(assistHintVisibility);
+ assistHintBottomRight.setVisibility(View.GONE);
+ updateView(assistHintTopLeft, Gravity.BOTTOM | Gravity.RIGHT, 180);
+ updateView(assistHintBottomLeft, Gravity.BOTTOM | Gravity.LEFT, 270);
+ }
+ }
+
private void updateView(View v, int gravity, int rotation) {
((FrameLayout.LayoutParams)v.getLayoutParams()).gravity = gravity;
v.setRotation(rotation);
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
index 51bd9f8..f0c38fb 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
@@ -169,7 +169,7 @@
}
protected boolean shouldShowOrb() {
- return true;
+ return false;
}
public void startAssist(Bundle args) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java
index 812c9a7..689d161 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java
@@ -212,7 +212,7 @@
return;
}
mMobileDrawable.setTintList(
- ColorStateList.valueOf(mDualToneHandler.getFillColor(darkIntensity)));
+ ColorStateList.valueOf(mDualToneHandler.getSingleColor(darkIntensity)));
ColorStateList color = ColorStateList.valueOf(getTint(area, this, tint));
mIn.setImageTintList(color);
mOut.setImageTintList(color);
@@ -238,7 +238,7 @@
// We want the ability to change the theme from the one set by SignalDrawable in certain
// surfaces. In this way, we can pass a theme to the view.
mMobileDrawable.setTintList(
- ColorStateList.valueOf(mDualToneHandler.getFillColor(intensity)));
+ ColorStateList.valueOf(mDualToneHandler.getSingleColor(intensity)));
mIn.setImageTintList(list);
mOut.setImageTintList(list);
mMobileType.setImageTintList(list);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java
index aba64bdf..f221865 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java
@@ -121,8 +121,8 @@
private final int mEdgeWidth;
// The slop to distinguish between horizontal and vertical motion
private final float mTouchSlop;
- // Minimum distance to move so that is can be considerd as a back swipe
- private final float mSwipeThreshold;
+ // Duration after which we consider the event as longpress.
+ private final int mLongPressTimeout;
// The threshold where the touch needs to be at most, such that the arrow is displayed above the
// finger, otherwise it will be below
private final int mMinArrowPosition;
@@ -164,8 +164,9 @@
// TODO: Get this for the current user
mEdgeWidth = res.getDimensionPixelSize(
com.android.internal.R.dimen.config_backGestureInset);
+
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
- mSwipeThreshold = res.getDimension(R.dimen.navigation_edge_action_drag_threshold);
+ mLongPressTimeout = ViewConfiguration.getLongPressTimeout();
mNavBarHeight = res.getDimensionPixelSize(R.dimen.navigation_bar_frame_height);
mMinArrowPosition = res.getDimensionPixelSize(
@@ -308,8 +309,18 @@
return !isInExcludedRegion;
}
+ private void cancelGesture(MotionEvent ev) {
+ // Send action cancel to reset all the touch events
+ mAllowGesture = false;
+ MotionEvent cancelEv = MotionEvent.obtain(ev);
+ cancelEv.setAction(MotionEvent.ACTION_CANCEL);
+ mEdgePanel.handleTouch(cancelEv);
+ cancelEv.recycle();
+ }
+
private void onMotionEvent(MotionEvent ev) {
- if (ev.getAction() == MotionEvent.ACTION_DOWN) {
+ int action = ev.getActionMasked();
+ if (action == MotionEvent.ACTION_DOWN) {
// Verify if this is in within the touch region and we aren't in immersive mode, and
// either the bouncer is showing or the notification panel is hidden
int stateFlags = mOverviewProxyService.getSystemUiStateFlags();
@@ -330,29 +341,35 @@
mThresholdCrossed = false;
}
} else if (mAllowGesture) {
- if (!mThresholdCrossed && ev.getAction() == MotionEvent.ACTION_MOVE) {
- float dx = Math.abs(ev.getX() - mDownPoint.x);
- float dy = Math.abs(ev.getY() - mDownPoint.y);
- if (dy > dx && dy > mTouchSlop) {
- // Send action cancel to reset all the touch events
- mAllowGesture = false;
- MotionEvent cancelEv = MotionEvent.obtain(ev);
- cancelEv.setAction(MotionEvent.ACTION_CANCEL);
- mEdgePanel.handleTouch(cancelEv);
- cancelEv.recycle();
+ if (!mThresholdCrossed) {
+ if (action == MotionEvent.ACTION_POINTER_DOWN) {
+ // We do not support multi touch for back gesture
+ cancelGesture(ev);
return;
+ } else if (action == MotionEvent.ACTION_MOVE) {
+ if ((ev.getEventTime() - ev.getDownTime()) > mLongPressTimeout) {
+ cancelGesture(ev);
+ return;
+ }
+ float dx = Math.abs(ev.getX() - mDownPoint.x);
+ float dy = Math.abs(ev.getY() - mDownPoint.y);
+ if (dy > dx && dy > mTouchSlop) {
+ cancelGesture(ev);
+ return;
- } else if (dx > dy && dx > mTouchSlop) {
- mThresholdCrossed = true;
- // Capture inputs
- mInputMonitor.pilferPointers();
+ } else if (dx > dy && dx > mTouchSlop) {
+ mThresholdCrossed = true;
+ // Capture inputs
+ mInputMonitor.pilferPointers();
+ }
}
+
}
// forward touch
mEdgePanel.handleTouch(ev);
- boolean isUp = ev.getAction() == MotionEvent.ACTION_UP;
+ boolean isUp = action == MotionEvent.ACTION_UP;
if (isUp) {
boolean performAction = mEdgePanel.shouldTriggerBack();
if (performAction) {
@@ -363,7 +380,7 @@
mOverviewProxyService.notifyBackAction(performAction, (int) mDownPoint.x,
(int) mDownPoint.y, false /* isButton */, !mIsOnLeftEdge);
}
- if (isUp || ev.getAction() == MotionEvent.ACTION_CANCEL) {
+ if (isUp || action == MotionEvent.ACTION_CANCEL) {
mRegionSamplingHelper.stop();
} else {
updateSamplingRect();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
index b8887c4..61a3940 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
@@ -95,6 +95,7 @@
private boolean mWasPulsingOnThisFrame;
private boolean mWakeAndUnlockRunning;
private boolean mKeyguardShowing;
+ private boolean mShowingLaunchAffordance;
private final KeyguardMonitor.Callback mKeyguardMonitorCallback =
new KeyguardMonitor.Callback() {
@@ -299,7 +300,8 @@
}
boolean onAodNotPulsingOrDocked = mDozing && (!mPulsing || mDocked);
- boolean invisible = onAodNotPulsingOrDocked || mWakeAndUnlockRunning;
+ boolean invisible = onAodNotPulsingOrDocked || mWakeAndUnlockRunning
+ || mShowingLaunchAffordance;
setVisibility(invisible ? INVISIBLE : VISIBLE);
updateClickability();
}
@@ -485,6 +487,14 @@
}
/**
+ * When we're launching an affordance, like double pressing power to open camera.
+ */
+ public void onShowingLaunchAffordanceChanged(boolean showing) {
+ mShowingLaunchAffordance = showing;
+ update();
+ }
+
+ /**
* Called whenever the scrims become opaque, transparent or semi-transparent.
*/
public void onScrimVisibilityChanged(@ScrimVisibility int scrimsVisible) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 3fe7f36..9da75b6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -151,7 +151,8 @@
private final NotificationWakeUpCoordinator mWakeUpCoordinator;
private final PulseExpansionHandler mPulseExpansionHandler;
- private KeyguardAffordanceHelper mAffordanceHelper;
+ @VisibleForTesting
+ protected KeyguardAffordanceHelper mAffordanceHelper;
private KeyguardUserSwitcher mKeyguardUserSwitcher;
@VisibleForTesting
protected KeyguardStatusBarView mKeyguardStatusBar;
@@ -340,6 +341,7 @@
*/
private int mThemeResId;
private KeyguardIndicationController mKeyguardIndicationController;
+ private Consumer<Boolean> mAffordanceLaunchListener;
@Inject
public NotificationPanelView(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs,
@@ -447,6 +449,14 @@
R.dimen.qs_notification_padding);
}
+ /**
+ * @see #launchCamera(boolean, int)
+ * @see #setLaunchingAffordance(boolean)
+ */
+ public void setLaunchAffordanceListener(Consumer<Boolean> listener) {
+ mAffordanceLaunchListener = listener;
+ }
+
public void updateResources() {
Resources res = getResources();
int qsWidth = res.getDimensionPixelSize(R.dimen.qs_panel_width);
@@ -2743,6 +2753,9 @@
private void setLaunchingAffordance(boolean launchingAffordance) {
getLeftIcon().setLaunchingAffordance(launchingAffordance);
getRightIcon().setLaunchingAffordance(launchingAffordance);
+ if (mAffordanceLaunchListener != null) {
+ mAffordanceLaunchListener.accept(launchingAffordance);
+ }
}
/**
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 72726b3..e029386 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -951,6 +951,9 @@
createUserSwitcher();
}
+ mNotificationPanel.setLaunchAffordanceListener(
+ mStatusBarWindow::onShowingLaunchAffordanceChanged);
+
// Set up the quick settings tile panel
View container = mStatusBarWindow.findViewById(R.id.qs_frame);
if (container != null) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
index 049972e..7d5f23b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
@@ -510,6 +510,15 @@
}
}
+ /**
+ * When we're launching an affordance, like double pressing power to open camera.
+ */
+ public void onShowingLaunchAffordanceChanged(boolean showing) {
+ if (mLockIcon != null) {
+ mLockIcon.onShowingLaunchAffordanceChanged(showing);
+ }
+ }
+
public class LayoutParams extends FrameLayout.LayoutParams {
public boolean ignoreRightInset;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/ExpandedAnimationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/ExpandedAnimationControllerTest.java
index a1c5707..74b15fb 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/ExpandedAnimationControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/ExpandedAnimationControllerTest.java
@@ -145,6 +145,7 @@
}
@Test
+ @Ignore("Flaky")
public void testMagnetToDismiss_dismiss() throws InterruptedException {
expand();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/StackAnimationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/StackAnimationControllerTest.java
index 9b894c3..9218a8b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/StackAnimationControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/StackAnimationControllerTest.java
@@ -234,6 +234,7 @@
}
@Test
+ @Ignore("Flaky")
public void testMagnetToDismiss_dismiss() throws InterruptedException {
final Runnable after = Mockito.mock(Runnable.class);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
index 2f9d892..1b7ca95 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
@@ -21,9 +21,11 @@
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import android.app.StatusBarManager;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
import android.view.MotionEvent;
@@ -36,6 +38,7 @@
import com.android.systemui.SysuiTestCase;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.AmbientPulseManager;
+import com.android.systemui.statusbar.KeyguardAffordanceView;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationShelf;
import com.android.systemui.statusbar.PulseExpansionHandler;
@@ -55,6 +58,8 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import java.util.function.Consumer;
+
@SmallTest
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper
@@ -90,6 +95,8 @@
private HeadsUpTouchHelper.Callback mHeadsUpCallback;
@Mock
private PanelBar mPanelBar;
+ @Mock
+ private KeyguardAffordanceHelper mAffordanceHelper;
private NotificationPanelView mNotificationPanelView;
@Before
@@ -112,6 +119,9 @@
mNotificationPanelView = new TestableNotificationPanelView(coordinator, expansionHandler);
mNotificationPanelView.setHeadsUpManager(mHeadsUpManager);
mNotificationPanelView.setBar(mPanelBar);
+
+ when(mKeyguardBottomArea.getLeftView()).thenReturn(mock(KeyguardAffordanceView.class));
+ when(mKeyguardBottomArea.getRightView()).thenReturn(mock(KeyguardAffordanceView.class));
}
@Test
@@ -129,6 +139,19 @@
}
@Test
+ public void testAffordanceLaunchingListener() {
+ Consumer<Boolean> listener = spy((showing) -> { });
+ mNotificationPanelView.setExpandedFraction(1f);
+ mNotificationPanelView.setLaunchAffordanceListener(listener);
+ mNotificationPanelView.launchCamera(false /* animate */,
+ StatusBarManager.CAMERA_LAUNCH_SOURCE_POWER_DOUBLE_TAP);
+ verify(listener).accept(eq(true));
+
+ mNotificationPanelView.onAffordanceLaunchEnded();
+ verify(listener).accept(eq(false));
+ }
+
+ @Test
public void testOnTouchEvent_expansionCanBeBlocked() {
mNotificationPanelView.onTouchEvent(MotionEvent.obtain(0L /* downTime */,
0L /* eventTime */, MotionEvent.ACTION_DOWN, 0f /* x */, 0f /* y */,
@@ -166,6 +189,7 @@
mKeyguardBottomArea = NotificationPanelViewTest.this.mKeyguardBottomArea;
mBigClockContainer = NotificationPanelViewTest.this.mBigClockContainer;
mQsFrame = NotificationPanelViewTest.this.mQsFrame;
+ mAffordanceHelper = NotificationPanelViewTest.this.mAffordanceHelper;
initDependencies(NotificationPanelViewTest.this.mStatusBar,
NotificationPanelViewTest.this.mGroupManager,
NotificationPanelViewTest.this.mNotificationShelf,
diff --git a/services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java b/services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java
index d2b71e5..d42943c 100644
--- a/services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java
+++ b/services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java
@@ -225,17 +225,7 @@
@Override
public void cancel() {
- synchronized (mLock) {
- final boolean cancelled = isCancelledLocked();
- final ICancellationSignal cancellation = mCancellation;
- if (!cancelled) {
- try {
- cancellation.cancel();
- } catch (RemoteException e) {
- Slog.e(mTag, "Error requesting a cancellation", e);
- }
- }
- }
+ PendingAutofillRequest.this.cancel();
}
};
}
@@ -304,7 +294,7 @@
try {
cancellation.cancel();
} catch (RemoteException e) {
- Slog.e(mTag, "Error cancelling a fill request", e);
+ Slog.e(mTag, "Error cancelling an augmented fill request", e);
}
}
return true;
diff --git a/services/core/java/com/android/server/content/SyncManager.java b/services/core/java/com/android/server/content/SyncManager.java
index d8b7c2e..fa8c48b 100644
--- a/services/core/java/com/android/server/content/SyncManager.java
+++ b/services/core/java/com/android/server/content/SyncManager.java
@@ -1170,7 +1170,7 @@
}
private void removeSyncsForAuthority(EndPoint info, String why) {
- mLogger.log("removeSyncsForAuthority: ", info);
+ mLogger.log("removeSyncsForAuthority: ", info, why);
verifyJobScheduler();
List<SyncOperation> ops = getAllPendingSyncs();
for (SyncOperation op: ops) {
diff --git a/services/core/java/com/android/server/content/SyncStorageEngine.java b/services/core/java/com/android/server/content/SyncStorageEngine.java
index c7a3f4b..e09c661 100644
--- a/services/core/java/com/android/server/content/SyncStorageEngine.java
+++ b/services/core/java/com/android/server/content/SyncStorageEngine.java
@@ -1027,7 +1027,7 @@
* Called when the set of account has changed, given the new array of
* active accounts.
*/
- public void removeStaleAccounts(@Nullable Account[] accounts, int userId) {
+ public void removeStaleAccounts(@Nullable Account[] currentAccounts, int userId) {
synchronized (mAuthorities) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Slog.v(TAG, "Updating for new accounts...");
@@ -1036,9 +1036,11 @@
Iterator<AccountInfo> accIt = mAccounts.values().iterator();
while (accIt.hasNext()) {
AccountInfo acc = accIt.next();
- if ((accounts == null) || (
- (acc.accountAndUser.userId == userId)
- && !ArrayUtils.contains(accounts, acc.accountAndUser.account))) {
+ if (acc.accountAndUser.userId != userId) {
+ continue; // Irrelevant user.
+ }
+ if ((currentAccounts == null)
+ || !ArrayUtils.contains(currentAccounts, acc.accountAndUser.account)) {
// This account no longer exists...
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Slog.v(TAG, "Account removed: " + acc.accountAndUser);
diff --git a/services/core/java/com/android/server/pm/ModuleInfoProvider.java b/services/core/java/com/android/server/pm/ModuleInfoProvider.java
index 6499530..69510d9 100644
--- a/services/core/java/com/android/server/pm/ModuleInfoProvider.java
+++ b/services/core/java/com/android/server/pm/ModuleInfoProvider.java
@@ -64,6 +64,7 @@
// TODO: Move this to an earlier boot phase if anybody requires it then.
private volatile boolean mMetadataLoaded;
+ private volatile String mPackageName;
ModuleInfoProvider(Context context, IPackageManager packageManager) {
mContext = context;
@@ -81,9 +82,9 @@
/** Called by the {@code PackageManager} when it has completed its boot sequence */
public void systemReady() {
- final String packageName = mContext.getResources().getString(
+ mPackageName = mContext.getResources().getString(
R.string.config_defaultModuleMetadataProvider);
- if (TextUtils.isEmpty(packageName)) {
+ if (TextUtils.isEmpty(mPackageName)) {
Slog.w(TAG, "No configured module metadata provider.");
return;
}
@@ -91,13 +92,13 @@
final Resources packageResources;
final PackageInfo pi;
try {
- pi = mPackageManager.getPackageInfo(packageName,
+ pi = mPackageManager.getPackageInfo(mPackageName,
PackageManager.GET_META_DATA, UserHandle.USER_SYSTEM);
- Context packageContext = mContext.createPackageContext(packageName, 0);
+ Context packageContext = mContext.createPackageContext(mPackageName, 0);
packageResources = packageContext.getResources();
} catch (RemoteException | NameNotFoundException e) {
- Slog.w(TAG, "Unable to discover metadata package: " + packageName, e);
+ Slog.w(TAG, "Unable to discover metadata package: " + mPackageName, e);
return;
}
@@ -201,4 +202,11 @@
return mModuleInfo.get(packageName);
}
+
+ String getPackageName() {
+ if (!mMetadataLoaded) {
+ throw new IllegalStateException("Call to getVersion before metadata loaded");
+ }
+ return mPackageName;
+ }
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index e07a132..e86f56f 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -5646,9 +5646,11 @@
private int checkUidPermissionImpl(String permName, int uid) {
synchronized (mPackages) {
final String[] packageNames = getPackagesForUid(uid);
- final PackageParser.Package pkg = (packageNames != null && packageNames.length > 0)
- ? mPackages.get(packageNames[0])
- : null;
+ PackageParser.Package pkg = null;
+ final int N = packageNames == null ? 0 : packageNames.length;
+ for (int i = 0; pkg == null && i < N; i++) {
+ pkg = mPackages.get(packageNames[i]);
+ }
// Additional logs for b/111075456; ignore system UIDs
if (pkg == null && UserHandle.getAppId(uid) >= Process.FIRST_APPLICATION_UID) {
if (packageNames == null || packageNames.length < 2) {
@@ -6385,6 +6387,16 @@
}
}
+ /**
+ * <em>IMPORTANT:</em> Not all packages returned by this method may be known
+ * to the system. There are two conditions in which this may occur:
+ * <ol>
+ * <li>The package is on adoptable storage and the device has been removed</li>
+ * <li>The package is being removed and the internal structures are partially updated</li>
+ * </ol>
+ * The second is an artifact of the current data structures and should be fixed. See
+ * b/111075456 for one such instance.
+ */
@Override
public String[] getPackagesForUid(int uid) {
return getPackagesForUid_debug(uid, false);
@@ -24074,6 +24086,11 @@
| (appInfo.isVendor() ? IPackageManagerNative.LOCATION_VENDOR : 0)
| (appInfo.isProduct() ? IPackageManagerNative.LOCATION_PRODUCT : 0));
}
+
+ @Override
+ public String getModuleMetadataPackageName() throws RemoteException {
+ return PackageManagerService.this.mModuleInfoProvider.getPackageName();
+ }
}
private class PackageManagerInternalImpl extends PackageManagerInternal {
diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
index 2b7691b8..2a1aee8 100644
--- a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
+++ b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
@@ -1347,6 +1347,7 @@
updatedUserIds);
updatedUserIds = setInitialGrantForNewImplicitPermissionsLocked(origPermissions,
permissionsState, pkg, newImplicitPermissions, updatedUserIds);
+ updatedUserIds = checkIfLegacyStorageOpsNeedToBeUpdated(pkg, replace, updatedUserIds);
}
// Persist the runtime permissions state for users with changes. If permissions
@@ -1473,6 +1474,28 @@
}
/**
+ * When the app has requested legacy storage we might need to update
+ * {@link android.app.AppOpsManager#OP_LEGACY_STORAGE}. Hence force an update in
+ * {@link com.android.server.policy.PermissionPolicyService#synchronizePackagePermissionsAndAppOpsForUser(Context, String, int)}
+ *
+ * @param pkg The package for which the permissions are updated
+ * @param replace If the app is being replaced
+ * @param updatedUserIds The ids of the users that already changed.
+ *
+ * @return The ids of the users that are changed
+ */
+ private @NonNull int[] checkIfLegacyStorageOpsNeedToBeUpdated(
+ @NonNull PackageParser.Package pkg, boolean replace, @NonNull int[] updatedUserIds) {
+ if (replace && pkg.applicationInfo.hasRequestedLegacyExternalStorage() && (
+ pkg.requestedPermissions.contains(READ_EXTERNAL_STORAGE)
+ || pkg.requestedPermissions.contains(WRITE_EXTERNAL_STORAGE))) {
+ return UserManagerService.getInstance().getUserIds();
+ }
+
+ return updatedUserIds;
+ }
+
+ /**
* Set the state of a implicit permission that is seen for the first time.
*
* @param origPs The permission state of the package before the split
diff --git a/services/core/java/com/android/server/policy/PermissionPolicyInternal.java b/services/core/java/com/android/server/policy/PermissionPolicyInternal.java
index ea8616c..7760c1e 100644
--- a/services/core/java/com/android/server/policy/PermissionPolicyInternal.java
+++ b/services/core/java/com/android/server/policy/PermissionPolicyInternal.java
@@ -17,6 +17,7 @@
package com.android.server.policy;
import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.content.Intent;
/**
@@ -34,5 +35,5 @@
* @return whether the activity should be started
*/
public abstract boolean checkStartActivity(@NonNull Intent intent, int callingUid,
- @NonNull String callingPackage);
+ @Nullable String callingPackage);
}
diff --git a/services/core/java/com/android/server/policy/PermissionPolicyService.java b/services/core/java/com/android/server/policy/PermissionPolicyService.java
index 570a153..02911e2 100644
--- a/services/core/java/com/android/server/policy/PermissionPolicyService.java
+++ b/services/core/java/com/android/server/policy/PermissionPolicyService.java
@@ -229,6 +229,15 @@
*
* @see #syncRestrictedOps
*/
+ private final @NonNull ArrayList<OpToUnrestrict> mOpsToAllowIfDefault = new ArrayList<>();
+
+ /**
+ * All ops that need to be flipped to allow.
+ *
+ * Currently, only used by the restricted permissions logic.
+ *
+ * @see #syncRestrictedOps
+ */
private final @NonNull ArrayList<OpToUnrestrict> mOpsToAllow = new ArrayList<>();
/**
@@ -238,7 +247,7 @@
*
* @see #syncRestrictedOps
*/
- private final @NonNull ArrayList<OpToUnrestrict> mOpsToIgnore = new ArrayList<>();
+ private final @NonNull ArrayList<OpToUnrestrict> mOpsToIgnoreIfDefault = new ArrayList<>();
/**
* All foreground permissions
@@ -262,11 +271,16 @@
final int allowCount = mOpsToAllow.size();
for (int i = 0; i < allowCount; i++) {
final OpToUnrestrict op = mOpsToAllow.get(i);
+ setUidModeAllowed(op.code, op.uid);
+ }
+ final int allowIfDefaultCount = mOpsToAllowIfDefault.size();
+ for (int i = 0; i < allowIfDefaultCount; i++) {
+ final OpToUnrestrict op = mOpsToAllowIfDefault.get(i);
setUidModeAllowedIfDefault(op.code, op.uid, op.packageName);
}
- final int ignoreCount = mOpsToIgnore.size();
- for (int i = 0; i < ignoreCount; i++) {
- final OpToUnrestrict op = mOpsToIgnore.get(i);
+ final int ignoreIfDefaultCount = mOpsToIgnoreIfDefault.size();
+ for (int i = 0; i < ignoreIfDefaultCount; i++) {
+ final OpToUnrestrict op = mOpsToIgnoreIfDefault.get(i);
setUidModeIgnoredIfDefault(op.code, op.uid, op.packageName);
}
final int defaultCount = mOpsToDefault.size();
@@ -341,7 +355,7 @@
if (applyRestriction) {
mOpsToDefault.add(new OpToRestrict(uid, opCode));
} else {
- mOpsToAllow.add(new OpToUnrestrict(uid, pkg.packageName, opCode));
+ mOpsToAllowIfDefault.add(new OpToUnrestrict(uid, pkg.packageName, opCode));
}
} else if (permissionInfo.isSoftRestricted()) {
// Storage uses a special app op to decide the mount state and
@@ -356,7 +370,7 @@
mOpsToAllow.add(new OpToUnrestrict(uid, pkg.packageName,
AppOpsManager.OP_LEGACY_STORAGE));
} else {
- mOpsToIgnore.add(new OpToUnrestrict(uid, pkg.packageName,
+ mOpsToIgnoreIfDefault.add(new OpToUnrestrict(uid, pkg.packageName,
AppOpsManager.OP_LEGACY_STORAGE));
}
}
@@ -421,6 +435,10 @@
setUidModeIfDefault(opCode, uid, AppOpsManager.MODE_ALLOWED, packageName);
}
+ private void setUidModeAllowed(int opCode, int uid) {
+ mAppOpsManager.setUidMode(opCode, uid, AppOpsManager.MODE_ALLOWED);
+ }
+
private void setUidModeIgnoredIfDefault(int opCode, int uid, @NonNull String packageName) {
setUidModeIfDefault(opCode, uid, AppOpsManager.MODE_IGNORED, packageName);
}
@@ -480,8 +498,9 @@
@Override
public boolean checkStartActivity(@NonNull Intent intent, int callingUid,
- @NonNull String callingPackage) {
- if (isActionRemovedForCallingPackage(intent.getAction(), callingPackage)) {
+ @Nullable String callingPackage) {
+ if (callingPackage != null && isActionRemovedForCallingPackage(intent.getAction(),
+ callingPackage)) {
Slog.w(LOG_TAG, "Action Removed: starting " + intent.toString() + " from "
+ callingPackage + " (uid=" + callingUid + ")");
return false;
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
index 55159c3..d77ea6e 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
@@ -51,8 +51,6 @@
import android.os.RemoteCallback;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
-import android.os.ResultReceiver;
-import android.os.ShellCallback;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
@@ -106,7 +104,6 @@
final ArraySet<Integer> mLoadedKeyphraseIds = new ArraySet<>();
ShortcutServiceInternal mShortcutServiceInternal;
SoundTriggerInternal mSoundTriggerInternal;
- private boolean mAllowInstantService;
private final RemoteCallbackList<IVoiceInteractionSessionListener>
mVoiceInteractionSessionListeners = new RemoteCallbackList<>();
@@ -173,14 +170,6 @@
mServiceStub.switchUser(userHandle);
}
- // Called by Shell cmd
- void setAllowInstantService(boolean allowed) {
- Log.i(TAG, "setAllowInstantService(): " + allowed);
- mContext.enforceCallingPermission(Manifest.permission.MANAGE_BIND_INSTANT_SERVICE,
- "setAllowInstantService");
- mAllowInstantService = allowed;
- }
-
class LocalService extends VoiceInteractionManagerInternal {
@Override
public void startLocalVoiceInteraction(IBinder callingActivity, Bundle options) {
@@ -234,7 +223,6 @@
new IVoiceInteractionSessionShowCallback.Stub() {
@Override
public void onFailed() {
- Slog.w(TAG, "startLocalVoiceInteraction() failed");
}
@Override
@@ -283,10 +271,7 @@
}
public void initForUser(int userHandle) {
- if (DEBUG) {
- Slog.d(TAG, "**************** initForUser user=" + userHandle
- + ", allowInstantService=" + mAllowInstantService);
- }
+ if (DEBUG) Slog.d(TAG, "**************** initForUser user=" + userHandle);
String curInteractorStr = Settings.Secure.getStringForUser(
mContext.getContentResolver(),
Settings.Secure.VOICE_INTERACTION_SERVICE, userHandle);
@@ -445,7 +430,6 @@
if (!mSafeMode) {
String curService = Settings.Secure.getStringForUser(
mResolver, Settings.Secure.VOICE_INTERACTION_SERVICE, mCurUser);
- if (DEBUG) Log.d(TAG, "Service for user " + mCurUser + ": " + curService);
ComponentName serviceComponent = null;
ServiceInfo serviceInfo = null;
if (curService != null && !curService.isEmpty()) {
@@ -482,8 +466,7 @@
}
if (hasComponent) {
setImplLocked(new VoiceInteractionManagerServiceImpl(mContext,
- UiThread.getHandler(), this, mCurUser, serviceComponent,
- mAllowInstantService));
+ UiThread.getHandler(), this, mCurUser, serviceComponent));
mImpl.startLocked();
} else {
setImplLocked(null);
@@ -1244,26 +1227,16 @@
synchronized (this) {
pw.println("VOICE INTERACTION MANAGER (dumpsys voiceinteraction)");
pw.println(" mEnableService: " + mEnableService);
- pw.println(" mAllowInstantService: " + mAllowInstantService);
if (mImpl == null) {
pw.println(" (No active implementation)");
return;
}
mImpl.dumpLocked(fd, pw, args);
}
-
mSoundTriggerInternal.dump(fd, pw, args);
}
@Override
- public void onShellCommand(FileDescriptor in, FileDescriptor out, FileDescriptor err,
- String[] args, ShellCallback callback, ResultReceiver resultReceiver)
- throws RemoteException {
- new VoiceInteractionManagerServiceShellCommand(VoiceInteractionManagerService.this)
- .exec(this, in, out, err, args, callback, resultReceiver);
- }
-
- @Override
public void setUiHints(IVoiceInteractionService service, Bundle hints) {
synchronized (this) {
enforceIsCurrentVoiceInteractionService(service);
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
index 4881ade..a1210cf 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
@@ -80,7 +80,6 @@
final VoiceInteractionServiceInfo mInfo;
final ComponentName mSessionComponentName;
final IWindowManager mIWindowManager;
- final boolean mAllowInstant;
boolean mBound = false;
IVoiceInteractionService mService;
@@ -126,7 +125,7 @@
VoiceInteractionManagerServiceImpl(Context context, Handler handler,
VoiceInteractionManagerService.VoiceInteractionManagerServiceStub stub,
- int userHandle, ComponentName service, boolean allowInstant) {
+ int userHandle, ComponentName service) {
mContext = context;
mHandler = handler;
mServiceStub = stub;
@@ -134,7 +133,6 @@
mComponent = service;
mAm = ActivityManager.getService();
mAtm = ActivityTaskManager.getService();
- mAllowInstant = allowInstant;
VoiceInteractionServiceInfo info;
try {
info = new VoiceInteractionServiceInfo(context.getPackageManager(), service, mUser);
@@ -169,7 +167,7 @@
if (mActiveSession == null) {
mActiveSession = new VoiceInteractionSessionConnection(mServiceStub,
mSessionComponentName, mUser, mContext, this,
- mInfo.getServiceInfo().applicationInfo.uid, mHandler, mAllowInstant);
+ mInfo.getServiceInfo().applicationInfo.uid, mHandler);
}
List<IBinder> activityTokens = null;
if (activityToken != null) {
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceShellCommand.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceShellCommand.java
deleted file mode 100644
index de1191f..0000000
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceShellCommand.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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 com.android.server.voiceinteraction;
-
-import android.annotation.NonNull;
-import android.os.ShellCommand;
-
-import java.io.PrintWriter;
-
-final class VoiceInteractionManagerServiceShellCommand extends ShellCommand {
-
- private final VoiceInteractionManagerService mService;
-
- VoiceInteractionManagerServiceShellCommand(@NonNull VoiceInteractionManagerService service) {
- this.mService = service;
- }
-
- @Override
- public int onCommand(String cmd) {
- if (cmd == null) {
- return handleDefaultCommands(cmd);
- }
- final PrintWriter pw = getOutPrintWriter();
- switch (cmd) {
- case "set bind-instant-service-allowed":
- case "set":
- return requestSet(pw);
- default:
- return handleDefaultCommands(cmd);
- }
- }
-
- @Override
- public void onHelp() {
- try (PrintWriter pw = getOutPrintWriter();) {
- pw.println("VoiceInteraction Service (voiceinteraction) commands:");
- pw.println(" help");
- pw.println(" Prints this help text.");
- pw.println("");
- pw.println(" set bind-instant-service-allowed [true | false]");
- pw.println(" Sets whether binding to services provided by instant apps is allowed");
- pw.println("");
- }
- }
-
- private int requestSet(@NonNull PrintWriter pw) {
- final String what = getNextArgRequired();
-
- switch(what) {
- case "bind-instant-service-allowed":
- return setBindInstantService(pw);
- default:
- pw.println("Invalid set: " + what);
- return -1;
- }
- }
-
- private int setBindInstantService(@NonNull PrintWriter pw) {
- final String mode = getNextArgRequired();
- switch (mode.toLowerCase()) {
- case "true":
- mService.setAllowInstantService(true);
- return 0;
- case "false":
- mService.setAllowInstantService(false);
- return 0;
- default:
- pw.println("Invalid mode: " + mode);
- return -1;
- }
- }
-}
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
index 3c47044..f16dec6 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
@@ -138,8 +138,7 @@
};
public VoiceInteractionSessionConnection(Object lock, ComponentName component, int user,
- Context context, Callback callback, int callingUid, Handler handler,
- boolean allowInstant) {
+ Context context, Callback callback, int callingUid, Handler handler) {
mLock = lock;
mSessionComponentName = component;
mUser = user;
@@ -160,13 +159,10 @@
mPermissionOwner = permOwner;
mBindIntent = new Intent(VoiceInteractionService.SERVICE_INTERFACE);
mBindIntent.setComponent(mSessionComponentName);
- int flags = Context.BIND_AUTO_CREATE | Context.BIND_WAIVE_PRIORITY
- | Context.BIND_ALLOW_OOM_MANAGEMENT
- | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS;
- if (allowInstant) {
- flags |= Context.BIND_ALLOW_INSTANT;
- }
- mBound = mContext.bindServiceAsUser(mBindIntent, this, flags, new UserHandle(mUser));
+ mBound = mContext.bindServiceAsUser(mBindIntent, this,
+ Context.BIND_AUTO_CREATE | Context.BIND_WAIVE_PRIORITY
+ | Context.BIND_ALLOW_OOM_MANAGEMENT
+ | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS, new UserHandle(mUser));
if (mBound) {
try {
mIWindowManager.addWindowToken(mToken, TYPE_VOICE_INTERACTION, DEFAULT_DISPLAY);