summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.bp2
-rw-r--r--api/system-current.txt1
-rw-r--r--core/java/android/app/SystemServiceRegistry.java10
-rw-r--r--core/java/android/content/Context.java4
-rw-r--r--core/java/android/content/res/ResourcesImpl.java3
-rw-r--r--core/java/android/net/NetworkTemplate.java37
-rw-r--r--core/java/android/os/UpdateEngine.java18
-rw-r--r--core/java/android/util/proto/ProtoInputStream.java8
-rw-r--r--core/java/android/view/DisplayCutout.java27
-rw-r--r--core/java/com/android/internal/infra/AndroidFuture.java14
-rw-r--r--core/java/com/android/internal/infra/ThrottledRunnable.java75
-rw-r--r--core/tests/coretests/src/android/view/DisplayCutoutTest.java4
-rw-r--r--libs/hwui/RecordingCanvas.cpp7
-rw-r--r--libs/hwui/pipeline/skia/SkiaPipeline.cpp3
-rw-r--r--libs/hwui/tests/unit/RenderNodeDrawableTests.cpp10
-rw-r--r--media/jni/android_media_ImageReader.cpp12
-rw-r--r--media/jni/android_media_ImageWriter.cpp13
-rw-r--r--media/jni/android_media_MediaMetadataRetriever.cpp29
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarFacetButton.java3
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarNavigationBarView.java28
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarNavigationButton.java3
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java7
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/net/DataUsageUtils.java18
-rw-r--r--packages/SettingsLib/tests/robotests/src/com/android/settingslib/net/DataUsageUtilsTest.java32
-rw-r--r--packages/SystemUI/res-keyguard/values-bs/strings.xml6
-rw-r--r--packages/SystemUI/res-keyguard/values-sq/strings.xml2
-rw-r--r--packages/SystemUI/res/values-ar/strings.xml2
-rw-r--r--packages/SystemUI/res/values-eu/strings.xml4
-rw-r--r--packages/SystemUI/res/values-hi/strings.xml4
-rw-r--r--packages/SystemUI/res/values-hy/strings.xml2
-rw-r--r--packages/SystemUI/res/values-in/strings.xml4
-rw-r--r--packages/SystemUI/res/values-sq/strings.xml4
-rw-r--r--packages/SystemUI/res/values-uk/strings.xml6
-rw-r--r--packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/Task.java14
-rw-r--r--packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java10
-rw-r--r--packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerImpl.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/classifier/brightline/BrightLineFalsingManager.java15
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt52
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java123
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java2
-rw-r--r--services/backup/java/com/android/server/backup/FullBackupJob.java4
-rw-r--r--services/backup/java/com/android/server/backup/KeyValueBackupJob.java3
-rw-r--r--services/backup/java/com/android/server/backup/restore/PerformUnifiedRestoreTask.java7
-rw-r--r--services/core/java/com/android/server/LocationManagerService.java2
-rw-r--r--services/core/java/com/android/server/accounts/AccountManagerService.java5
-rw-r--r--services/core/java/com/android/server/am/OomAdjProfiler.java61
-rw-r--r--services/core/java/com/android/server/audio/AudioService.java9
-rw-r--r--services/core/java/com/android/server/net/NetworkPolicyManagerService.java17
-rw-r--r--services/core/java/com/android/server/pm/StagingManager.java79
-rw-r--r--services/core/java/com/android/server/policy/PermissionPolicyService.java21
-rw-r--r--services/core/java/com/android/server/role/RoleManagerService.java122
-rw-r--r--services/usage/java/com/android/server/usage/UsageStatsProto.java10
-rw-r--r--telephony/java/android/telephony/SubscriptionManager.java23
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java27
-rw-r--r--telephony/java/android/telephony/ims/RcsControllerCall.java20
-rw-r--r--telephony/java/android/telephony/ims/RcsManager.java43
-rw-r--r--telephony/java/android/telephony/ims/RcsMessageManager.java (renamed from telephony/java/android/telephony/ims/RcsMessageStore.java)12
-rw-r--r--telephony/java/android/telephony/ims/aidl/IRcsMessage.aidl (renamed from telephony/java/android/telephony/ims/aidl/IRcs.aidl)2
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephony.aidl5
-rw-r--r--telephony/java/com/android/internal/telephony/TelephonyPermissions.java21
-rw-r--r--tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamBoolTest.java24
-rw-r--r--tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamBytesTest.java24
-rw-r--r--tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamDoubleTest.java24
-rw-r--r--tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamEnumTest.java24
-rw-r--r--tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFixed32Test.java24
-rw-r--r--tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFixed64Test.java24
-rw-r--r--tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFloatTest.java24
-rw-r--r--tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamInt32Test.java24
-rw-r--r--tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamInt64Test.java24
-rw-r--r--tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamObjectTest.java24
-rw-r--r--tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSFixed32Test.java24
-rw-r--r--tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSFixed64Test.java24
-rw-r--r--tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSInt32Test.java24
-rw-r--r--tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSInt64Test.java24
-rw-r--r--tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamStringTest.java24
-rw-r--r--tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamUInt32Test.java24
-rw-r--r--tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamUInt64Test.java24
-rw-r--r--tools/aapt2/cmd/Optimize.h2
-rw-r--r--tools/preload2/Android.bp50
-rw-r--r--tools/preload2/Android.mk30
86 files changed, 1009 insertions, 623 deletions
diff --git a/Android.bp b/Android.bp
index 29d6c91eb8f8..7219ef59daa5 100644
--- a/Android.bp
+++ b/Android.bp
@@ -565,7 +565,7 @@ java_defaults {
"telephony/java/android/telephony/ims/aidl/IImsServiceController.aidl",
"telephony/java/android/telephony/ims/aidl/IImsServiceControllerListener.aidl",
"telephony/java/android/telephony/ims/aidl/IImsSmsListener.aidl",
- "telephony/java/android/telephony/ims/aidl/IRcs.aidl",
+ "telephony/java/android/telephony/ims/aidl/IRcsMessage.aidl",
"telephony/java/android/telephony/mbms/IMbmsDownloadSessionCallback.aidl",
"telephony/java/android/telephony/mbms/IMbmsStreamingSessionCallback.aidl",
"telephony/java/android/telephony/mbms/IMbmsGroupCallSessionCallback.aidl",
diff --git a/api/system-current.txt b/api/system-current.txt
index 6fcf0559aec6..48804b6be72a 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -5483,6 +5483,7 @@ package android.os {
public class UpdateEngine {
ctor public UpdateEngine();
method public void applyPayload(String, long, long, String[]);
+ method public void applyPayload(java.io.FileDescriptor, long, long, String[]);
method public boolean bind(android.os.UpdateEngineCallback, android.os.Handler);
method public boolean bind(android.os.UpdateEngineCallback);
method public void cancel();
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java
index d32b6b516a7d..cfe2cf09ae19 100644
--- a/core/java/android/app/SystemServiceRegistry.java
+++ b/core/java/android/app/SystemServiceRegistry.java
@@ -172,7 +172,7 @@ import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.euicc.EuiccCardManager;
import android.telephony.euicc.EuiccManager;
-import android.telephony.ims.RcsManager;
+import android.telephony.ims.RcsMessageManager;
import android.util.ArrayMap;
import android.util.Log;
import android.view.ContextThemeWrapper;
@@ -614,11 +614,11 @@ final class SystemServiceRegistry {
return new SubscriptionManager(ctx.getOuterContext());
}});
- registerService(Context.TELEPHONY_RCS_SERVICE, RcsManager.class,
- new CachedServiceFetcher<RcsManager>() {
+ registerService(Context.TELEPHONY_RCS_MESSAGE_SERVICE, RcsMessageManager.class,
+ new CachedServiceFetcher<RcsMessageManager>() {
@Override
- public RcsManager createService(ContextImpl ctx) {
- return new RcsManager(ctx.getOuterContext());
+ public RcsMessageManager createService(ContextImpl ctx) {
+ return new RcsMessageManager(ctx.getOuterContext());
}
});
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 341fc26e2b96..7a013f176691 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -4665,10 +4665,10 @@ public abstract class Context {
/**
* Use with {@link #getSystemService(String)} to retrieve an
- * {@link android.telephony.ims.RcsManager}.
+ * {@link android.telephony.ims.RcsMessageManager}.
* @hide
*/
- public static final String TELEPHONY_RCS_SERVICE = "ircs";
+ public static final String TELEPHONY_RCS_MESSAGE_SERVICE = "ircsmessage";
/**
* Use with {@link #getSystemService(String)} to retrieve an
diff --git a/core/java/android/content/res/ResourcesImpl.java b/core/java/android/content/res/ResourcesImpl.java
index 794be9e202be..b72544c02d6a 100644
--- a/core/java/android/content/res/ResourcesImpl.java
+++ b/core/java/android/content/res/ResourcesImpl.java
@@ -856,7 +856,8 @@ public class ResourcesImpl {
stack.push(id);
try {
if (file.endsWith(".xml")) {
- if (file.startsWith("res/color/")) {
+ final String typeName = getResourceTypeName(id);
+ if (typeName != null && typeName.equals("color")) {
dr = loadColorOrXmlDrawable(wrapper, value, id, density, file);
} else {
dr = loadXmlDrawable(wrapper, value, id, density, file);
diff --git a/core/java/android/net/NetworkTemplate.java b/core/java/android/net/NetworkTemplate.java
index ae421a4991a4..87c7118c0ed8 100644
--- a/core/java/android/net/NetworkTemplate.java
+++ b/core/java/android/net/NetworkTemplate.java
@@ -48,6 +48,7 @@ import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Arrays;
+import java.util.List;
import java.util.Objects;
/**
@@ -481,17 +482,39 @@ public class NetworkTemplate implements Parcelable {
* For example, given an incoming template matching B, and the currently
* active merge set [A,B], we'd return a new template that primarily matches
* A, but also matches B.
+ * TODO: remove and use {@link #normalize(NetworkTemplate, List)}.
*/
@UnsupportedAppUsage
public static NetworkTemplate normalize(NetworkTemplate template, String[] merged) {
- if (template.isMatchRuleMobile() && ArrayUtils.contains(merged, template.mSubscriberId)) {
- // Requested template subscriber is part of the merge group; return
- // a template that matches all merged subscribers.
- return new NetworkTemplate(template.mMatchRule, merged[0], merged,
- template.mNetworkId);
- } else {
- return template;
+ return normalize(template, Arrays.<String[]>asList(merged));
+ }
+
+ /**
+ * Examine the given template and normalize if it refers to a "merged"
+ * mobile subscriber. We pick the "lowest" merged subscriber as the primary
+ * for key purposes, and expand the template to match all other merged
+ * subscribers.
+ *
+ * There can be multiple merged subscriberIds for multi-SIM devices.
+ *
+ * <p>
+ * For example, given an incoming template matching B, and the currently
+ * active merge set [A,B], we'd return a new template that primarily matches
+ * A, but also matches B.
+ */
+ public static NetworkTemplate normalize(NetworkTemplate template, List<String[]> mergedList) {
+ if (!template.isMatchRuleMobile()) return template;
+
+ for (String[] merged : mergedList) {
+ if (ArrayUtils.contains(merged, template.mSubscriberId)) {
+ // Requested template subscriber is part of the merge group; return
+ // a template that matches all merged subscribers.
+ return new NetworkTemplate(template.mMatchRule, merged[0], merged,
+ template.mNetworkId);
+ }
}
+
+ return template;
}
@UnsupportedAppUsage
diff --git a/core/java/android/os/UpdateEngine.java b/core/java/android/os/UpdateEngine.java
index 5cf3b970c00c..29af17afc872 100644
--- a/core/java/android/os/UpdateEngine.java
+++ b/core/java/android/os/UpdateEngine.java
@@ -21,6 +21,8 @@ import android.os.IUpdateEngine;
import android.os.IUpdateEngineCallback;
import android.os.RemoteException;
+import java.io.FileDescriptor;
+
/**
* UpdateEngine handles calls to the update engine which takes care of A/B OTA
* updates. It wraps up the update engine Binder APIs and exposes them as
@@ -312,6 +314,22 @@ public class UpdateEngine {
}
/**
+ * Applies the payload passed as file descriptor {@code fd} instead of
+ * using the {@code file://} scheme.
+ *
+ * <p>See {@link #applyPayload(String)} for {@code offset}, {@code size} and
+ * {@code headerKeyValuePairs} parameters.
+ */
+ public void applyPayload(FileDescriptor fd, long offset, long size,
+ String[] headerKeyValuePairs) {
+ try {
+ mUpdateEngine.applyPayloadFd(fd, offset, size, headerKeyValuePairs);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Permanently cancels an in-progress update.
*
* <p>See {@link #resetStatus} to undo a finshed update (only available
diff --git a/core/java/android/util/proto/ProtoInputStream.java b/core/java/android/util/proto/ProtoInputStream.java
index c290dffc42c9..24e7d2b3589b 100644
--- a/core/java/android/util/proto/ProtoInputStream.java
+++ b/core/java/android/util/proto/ProtoInputStream.java
@@ -253,12 +253,14 @@ public final class ProtoInputStream extends ProtoStream {
}
/**
- * Attempt to guess the next field. If there is a match, the field data will be ready to read.
- * If there is no match, nextField will need to be called to get the field number
+ * Reads the tag of the next field from the stream. If previous field value was not read, its
+ * data will be skipped over. If {@code fieldId} matches the next field ID, the field data will
+ * be ready to read. If it does not match, {@link #nextField()} or {@link #nextField(long)} will
+ * need to be called again before the field data can be read.
*
* @return true if fieldId matches the next field, false if not
*/
- public boolean isNextField(long fieldId) throws IOException {
+ public boolean nextField(long fieldId) throws IOException {
if (nextField() == (int) fieldId) {
return true;
}
diff --git a/core/java/android/view/DisplayCutout.java b/core/java/android/view/DisplayCutout.java
index 715181f28076..797c128e514c 100644
--- a/core/java/android/view/DisplayCutout.java
+++ b/core/java/android/view/DisplayCutout.java
@@ -319,18 +319,23 @@ public final class DisplayCutout {
sortedBounds[i] = ZERO_RECT;
}
if (safeInsets != null && boundingRects != null) {
+ // There is at most one non-functional area per short edge of the device, but none
+ // on the long edges, so either a) safeInsets.top and safeInsets.bottom is 0, or
+ // b) safeInsets.left and safeInset.right is 0.
+ final boolean topBottomInset = safeInsets.top > 0 || safeInsets.bottom > 0;
for (Rect bound : boundingRects) {
- // There is at most one non-functional area per short edge of the device, but none
- // on the long edges, so either safeInsets.right or safeInsets.bottom must be 0.
- // TODO(b/117199965): Refine the logic to handle edge cases.
- if (bound.left == 0) {
- sortedBounds[BOUNDS_POSITION_LEFT] = bound;
- } else if (bound.top == 0) {
- sortedBounds[BOUNDS_POSITION_TOP] = bound;
- } else if (safeInsets.right > 0) {
- sortedBounds[BOUNDS_POSITION_RIGHT] = bound;
- } else if (safeInsets.bottom > 0) {
- sortedBounds[BOUNDS_POSITION_BOTTOM] = bound;
+ if (topBottomInset) {
+ if (bound.top == 0) {
+ sortedBounds[BOUNDS_POSITION_TOP] = bound;
+ } else {
+ sortedBounds[BOUNDS_POSITION_BOTTOM] = bound;
+ }
+ } else {
+ if (bound.left == 0) {
+ sortedBounds[BOUNDS_POSITION_LEFT] = bound;
+ } else {
+ sortedBounds[BOUNDS_POSITION_RIGHT] = bound;
+ }
}
}
}
diff --git a/core/java/com/android/internal/infra/AndroidFuture.java b/core/java/com/android/internal/infra/AndroidFuture.java
index c7c29240699d..c8929e93f030 100644
--- a/core/java/com/android/internal/infra/AndroidFuture.java
+++ b/core/java/com/android/internal/infra/AndroidFuture.java
@@ -115,6 +115,20 @@ public class AndroidFuture<T> extends CompletableFuture<T> implements Parcelable
}
}
+ /**
+ * Create a completed future with the given value.
+ *
+ * @param value the value for the completed future
+ * @param <U> the type of the value
+ * @return the completed future
+ */
+ @NonNull
+ public static <U> AndroidFuture<U> completedFuture(U value) {
+ AndroidFuture<U> future = new AndroidFuture<>();
+ future.complete(value);
+ return future;
+ }
+
@Override
public boolean complete(@Nullable T value) {
boolean changed = super.complete(value);
diff --git a/core/java/com/android/internal/infra/ThrottledRunnable.java b/core/java/com/android/internal/infra/ThrottledRunnable.java
new file mode 100644
index 000000000000..9846fa9815ec
--- /dev/null
+++ b/core/java/com/android/internal/infra/ThrottledRunnable.java
@@ -0,0 +1,75 @@
+/*
+ * 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.internal.infra;
+
+import android.annotation.NonNull;
+import android.os.Handler;
+import android.os.SystemClock;
+
+import com.android.internal.annotations.GuardedBy;
+
+/**
+ * A throttled runnable that can wrap around a runnable and throttle calls to its run().
+ *
+ * The throttling logic makes sure that the original runnable will be called only after the
+ * specified interval passes since the last actual call. The first call in a while (after the
+ * specified interval passes since the last actual call) will always result in the original runnable
+ * being called immediately, and then subsequent calls will start to be throttled. It is guaranteed
+ * that any call to this throttled runnable will always result in the original runnable being called
+ * afterwards, within the specified interval.
+ */
+public class ThrottledRunnable implements Runnable {
+
+ @NonNull
+ private final Handler mHandler;
+ private final long mIntervalMillis;
+ @NonNull
+ private final Runnable mRunnable;
+
+ @NonNull
+ private final Object mLock = new Object();
+
+ @GuardedBy("mLock")
+ private long mScheduledUptimeMillis;
+
+ public ThrottledRunnable(@NonNull Handler handler, long intervalMillis,
+ @NonNull Runnable runnable) {
+ mHandler = handler;
+ mIntervalMillis = intervalMillis;
+ mRunnable = runnable;
+ }
+
+ @Override
+ public void run() {
+ synchronized (mLock) {
+ if (mHandler.hasCallbacks(mRunnable)) {
+ // We have a scheduled runnable.
+ return;
+ }
+ long currentUptimeMillis = SystemClock.uptimeMillis();
+ if (mScheduledUptimeMillis == 0
+ || currentUptimeMillis > mScheduledUptimeMillis + mIntervalMillis) {
+ // First time in a while, schedule immediately.
+ mScheduledUptimeMillis = currentUptimeMillis;
+ } else {
+ // We were scheduled not long ago, so schedule with delay for throttling.
+ mScheduledUptimeMillis = mScheduledUptimeMillis + mIntervalMillis;
+ }
+ mHandler.postAtTime(mRunnable, mScheduledUptimeMillis);
+ }
+ }
+}
diff --git a/core/tests/coretests/src/android/view/DisplayCutoutTest.java b/core/tests/coretests/src/android/view/DisplayCutoutTest.java
index 182fe78dfa7a..d5a0dfadcbe5 100644
--- a/core/tests/coretests/src/android/view/DisplayCutoutTest.java
+++ b/core/tests/coretests/src/android/view/DisplayCutoutTest.java
@@ -104,8 +104,8 @@ public class DisplayCutoutTest {
@Test
public void testExtractBoundsFromList_top_and_bottom() {
- Rect safeInsets = new Rect(0, 1, 0, 10);
- Rect boundTop = new Rect(80, 0, 120, 10);
+ Rect safeInsets = new Rect(0, 10, 0, 10);
+ Rect boundTop = new Rect(0, 0, 120, 10);
Rect boundBottom = new Rect(80, 190, 120, 200);
assertThat(extractBoundsFromList(safeInsets,
Arrays.asList(new Rect[]{boundTop, boundBottom})),
diff --git a/libs/hwui/RecordingCanvas.cpp b/libs/hwui/RecordingCanvas.cpp
index e58fbbe8e667..c8eb1ca55910 100644
--- a/libs/hwui/RecordingCanvas.cpp
+++ b/libs/hwui/RecordingCanvas.cpp
@@ -274,7 +274,12 @@ struct DrawDrawable final : Op {
}
sk_sp<SkDrawable> drawable;
SkMatrix matrix = SkMatrix::I();
- void draw(SkCanvas* c, const SkMatrix&) const { c->drawDrawable(drawable.get(), &matrix); }
+ // It is important that we call drawable->draw(c) here instead of c->drawDrawable(drawable).
+ // Drawables are mutable and in cases, like RenderNodeDrawable, are not expected to produce the
+ // same content if retained outside the duration of the frame. Therefore we resolve
+ // them now and do not allow the canvas to take a reference to the drawable and potentially
+ // keep it alive for longer than the frames duration (e.g. SKP serialization).
+ void draw(SkCanvas* c, const SkMatrix&) const { drawable->draw(c, &matrix); }
};
struct DrawPicture final : Op {
static const auto kType = Type::DrawPicture;
diff --git a/libs/hwui/pipeline/skia/SkiaPipeline.cpp b/libs/hwui/pipeline/skia/SkiaPipeline.cpp
index 84c0d1369e83..530926bf8dd0 100644
--- a/libs/hwui/pipeline/skia/SkiaPipeline.cpp
+++ b/libs/hwui/pipeline/skia/SkiaPipeline.cpp
@@ -313,8 +313,7 @@ SkCanvas* SkiaPipeline::tryCapture(SkSurface* surface) {
case CaptureMode::CallbackAPI:
case CaptureMode::SingleFrameSKP:
mRecorder.reset(new SkPictureRecorder());
- pictureCanvas = mRecorder->beginRecording(surface->width(), surface->height(),
- nullptr, SkPictureRecorder::kPlaybackDrawPicture_RecordFlag);
+ pictureCanvas = mRecorder->beginRecording(surface->width(), surface->height());
break;
case CaptureMode::MultiFrameSKP:
// If a multi frame recording is active, initialize recording for a single frame of a
diff --git a/libs/hwui/tests/unit/RenderNodeDrawableTests.cpp b/libs/hwui/tests/unit/RenderNodeDrawableTests.cpp
index c813cd945905..e70378bd15a5 100644
--- a/libs/hwui/tests/unit/RenderNodeDrawableTests.cpp
+++ b/libs/hwui/tests/unit/RenderNodeDrawableTests.cpp
@@ -1096,10 +1096,8 @@ TEST(ReorderBarrierDrawable, testShadowMatrix) {
int getDrawCounter() { return mDrawCounter; }
virtual void onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix) override {
- // expect to draw 2 RenderNodeDrawable, 1 StartReorderBarrierDrawable,
- // 1 EndReorderBarrierDrawable
- mDrawCounter++;
- SkCanvas::onDrawDrawable(drawable, matrix);
+ // Do not expect this to be called. See RecordingCanvas.cpp DrawDrawable for context.
+ EXPECT_TRUE(false);
}
virtual void didTranslate(SkScalar dx, SkScalar dy) override {
@@ -1159,8 +1157,8 @@ TEST(ReorderBarrierDrawable, testShadowMatrix) {
// create a canvas not backed by any device/pixels, but with dimensions to avoid quick rejection
ShadowTestCanvas canvas(CANVAS_WIDTH, CANVAS_HEIGHT);
RenderNodeDrawable drawable(parent.get(), &canvas, false);
- canvas.drawDrawable(&drawable);
- EXPECT_EQ(9, canvas.getDrawCounter());
+ drawable.draw(&canvas);
+ EXPECT_EQ(5, canvas.getDrawCounter());
}
// Draw a vector drawable twice but with different bounds and verify correct bounds are used.
diff --git a/media/jni/android_media_ImageReader.cpp b/media/jni/android_media_ImageReader.cpp
index 77878f83b072..0a02156ccf76 100644
--- a/media/jni/android_media_ImageReader.cpp
+++ b/media/jni/android_media_ImageReader.cpp
@@ -416,11 +416,13 @@ static void ImageReader_init(JNIEnv* env, jobject thiz, jobject weakThiz, jint w
if (res != OK) {
jniThrowExceptionFmt(env, "java/lang/IllegalStateException",
"Failed to set buffer consumer default format 0x%x", nativeFormat);
+ return;
}
res = bufferConsumer->setDefaultBufferDataSpace(nativeDataspace);
if (res != OK) {
jniThrowExceptionFmt(env, "java/lang/IllegalStateException",
"Failed to set buffer consumer default dataSpace 0x%x", nativeDataspace);
+ return;
}
}
@@ -704,7 +706,7 @@ static void Image_getLockedImage(JNIEnv* env, jobject thiz, LockedImage *image)
// and we don't set them here.
}
-static void Image_getLockedImageInfo(JNIEnv* env, LockedImage* buffer, int idx,
+static bool Image_getLockedImageInfo(JNIEnv* env, LockedImage* buffer, int idx,
int32_t writerFormat, uint8_t **base, uint32_t *size, int *pixelStride, int *rowStride) {
ALOGV("%s", __FUNCTION__);
@@ -713,7 +715,9 @@ static void Image_getLockedImageInfo(JNIEnv* env, LockedImage* buffer, int idx,
if (res != OK) {
jniThrowExceptionFmt(env, "java/lang/UnsupportedOperationException",
"Pixel format: 0x%x is unsupported", buffer->flexFormat);
+ return false;
}
+ return true;
}
static jobjectArray Image_createSurfacePlanes(JNIEnv* env, jobject thiz,
@@ -756,8 +760,10 @@ static jobjectArray Image_createSurfacePlanes(JNIEnv* env, jobject thiz,
}
// Create all SurfacePlanes
for (int i = 0; i < numPlanes; i++) {
- Image_getLockedImageInfo(env, &lockedImg, i, halReaderFormat,
- &pData, &dataSize, &pixelStride, &rowStride);
+ if (!Image_getLockedImageInfo(env, &lockedImg, i, halReaderFormat,
+ &pData, &dataSize, &pixelStride, &rowStride)) {
+ return NULL;
+ }
byteBuffer = env->NewDirectByteBuffer(pData, dataSize);
if ((byteBuffer == NULL) && (env->ExceptionCheck() == false)) {
jniThrowException(env, "java/lang/IllegalStateException",
diff --git a/media/jni/android_media_ImageWriter.cpp b/media/jni/android_media_ImageWriter.cpp
index 728c55e5e6f7..6d8b966f35d5 100644
--- a/media/jni/android_media_ImageWriter.cpp
+++ b/media/jni/android_media_ImageWriter.cpp
@@ -777,6 +777,7 @@ static void Image_unlockIfLocked(JNIEnv* env, jobject thiz) {
status_t res = buffer->unlock();
if (res != OK) {
jniThrowRuntimeException(env, "unlock buffer failed");
+ return;
}
ALOGV("Successfully unlocked the image");
}
@@ -872,7 +873,7 @@ static void Image_getLockedImage(JNIEnv* env, jobject thiz, LockedImage *image)
// and we don't set them here.
}
-static void Image_getLockedImageInfo(JNIEnv* env, LockedImage* buffer, int idx,
+static bool Image_getLockedImageInfo(JNIEnv* env, LockedImage* buffer, int idx,
int32_t writerFormat, uint8_t **base, uint32_t *size, int *pixelStride, int *rowStride) {
ALOGV("%s", __FUNCTION__);
@@ -880,8 +881,10 @@ static void Image_getLockedImageInfo(JNIEnv* env, LockedImage* buffer, int idx,
pixelStride, rowStride);
if (res != OK) {
jniThrowExceptionFmt(env, "java/lang/UnsupportedOperationException",
- "Pixel format: 0x%x is unsupported", buffer->flexFormat);
+ "Pixel format: 0x%x is unsupported", writerFormat);
+ return false;
}
+ return true;
}
static jobjectArray Image_createSurfacePlanes(JNIEnv* env, jobject thiz,
@@ -920,8 +923,10 @@ static jobjectArray Image_createSurfacePlanes(JNIEnv* env, jobject thiz,
PublicFormat publicWriterFormat = static_cast<PublicFormat>(writerFormat);
writerFormat = mapPublicFormatToHalFormat(publicWriterFormat);
for (int i = 0; i < numPlanes; i++) {
- Image_getLockedImageInfo(env, &lockedImg, i, writerFormat,
- &pData, &dataSize, &pixelStride, &rowStride);
+ if (!Image_getLockedImageInfo(env, &lockedImg, i, writerFormat,
+ &pData, &dataSize, &pixelStride, &rowStride)) {
+ return NULL;
+ }
byteBuffer = env->NewDirectByteBuffer(pData, dataSize);
if ((byteBuffer == NULL) && (env->ExceptionCheck() == false)) {
jniThrowException(env, "java/lang/IllegalStateException",
diff --git a/media/jni/android_media_MediaMetadataRetriever.cpp b/media/jni/android_media_MediaMetadataRetriever.cpp
index a4807843d7d8..3809bc4752a8 100644
--- a/media/jni/android_media_MediaMetadataRetriever.cpp
+++ b/media/jni/android_media_MediaMetadataRetriever.cpp
@@ -501,15 +501,7 @@ static jobject android_media_MediaMetadataRetriever_getFrameAtIndex(
return NULL;
}
- int colorFormat = getColorFormat(env, params);
- std::vector<sp<IMemory> > frames;
- status_t err = retriever->getFrameAtIndex(&frames, frameIndex, numFrames, colorFormat);
- if (err != OK || frames.size() == 0) {
- jniThrowException(env,
- "java/lang/IllegalStateException", "No frames from retriever");
- return NULL;
- }
jobject arrayList = env->NewObject(fields.arrayListClazz, fields.arrayListInit);
if (arrayList == NULL) {
jniThrowException(env,
@@ -517,18 +509,29 @@ static jobject android_media_MediaMetadataRetriever_getFrameAtIndex(
return NULL;
}
+ int colorFormat = getColorFormat(env, params);
SkColorType outColorType = setOutColorType(env, colorFormat, params);
-
- for (size_t i = 0; i < frames.size(); i++) {
- if (frames[i] == NULL || frames[i]->pointer() == NULL) {
+ size_t i = 0;
+ for (; i < numFrames; i++) {
+ sp<IMemory> frame = retriever->getFrameAtIndex(frameIndex + i, colorFormat);
+ if (frame == NULL || frame->pointer() == NULL) {
ALOGE("video frame at index %zu is a NULL pointer", frameIndex + i);
- continue;
+ break;
}
- VideoFrame *videoFrame = static_cast<VideoFrame *>(frames[i]->pointer());
+ VideoFrame *videoFrame = static_cast<VideoFrame *>(frame->pointer());
jobject bitmapObj = getBitmapFromVideoFrame(env, videoFrame, -1, -1, outColorType);
env->CallBooleanMethod(arrayList, fields.arrayListAdd, bitmapObj);
env->DeleteLocalRef(bitmapObj);
}
+
+ if (i == 0) {
+ env->DeleteLocalRef(arrayList);
+
+ jniThrowException(env,
+ "java/lang/IllegalStateException", "No frames from retriever");
+ return NULL;
+ }
+
return arrayList;
}
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarFacetButton.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarFacetButton.java
index 0f4cf21e07c2..0421c3bebcfc 100644
--- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarFacetButton.java
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarFacetButton.java
@@ -20,6 +20,7 @@ import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
+import android.os.Build;
import android.os.UserHandle;
import android.util.AttributeSet;
import android.view.Display;
@@ -122,7 +123,7 @@ public class CarFacetButton extends LinearLayout {
new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS), UserHandle.CURRENT);
});
- if (longPressIntentString != null) {
+ if (longPressIntentString != null && (Build.IS_ENG || Build.IS_USERDEBUG)) {
final Intent longPressIntent = Intent.parseUri(longPressIntentString,
Intent.URI_INTENT_SCHEME);
setOnLongClickListener(v -> {
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarNavigationBarView.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarNavigationBarView.java
index 095e2e93df72..05a41e68e972 100644
--- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarNavigationBarView.java
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarNavigationBarView.java
@@ -17,7 +17,6 @@
package com.android.systemui.statusbar.car;
import android.content.Context;
-import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
@@ -75,40 +74,13 @@ class CarNavigationBarView extends LinearLayout {
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (mStatusBarWindowTouchListener != null) {
- boolean shouldConsumeEvent = shouldConsumeNotificationButtonEvent(ev);
// Forward touch events to the status bar window so it can drag
// windows if required (Notification shade)
mStatusBarWindowTouchListener.onTouch(this, ev);
- // return true if child views should not receive this event.
- if (shouldConsumeEvent) {
- return true;
- }
}
return super.onInterceptTouchEvent(ev);
}
- /**
- * If the motion event is over top of the notification button while the notification
- * panel is open, we need the statusbar touch listeners handle the event instead of the button.
- * Since the statusbar listener will trigger a close of the notification panel before the
- * any button click events are fired this will prevent reopening the panel.
- *
- * Note: we can't use requestDisallowInterceptTouchEvent because the gesture detector will
- * always receive the ACTION_DOWN and thus think a longpress happened if no other events are
- * received
- *
- * @return true if the notification button should not receive the event
- */
- private boolean shouldConsumeNotificationButtonEvent(MotionEvent ev) {
- if (mNotificationsButton == null || !mCarStatusBar.isNotificationPanelOpen()) {
- return false;
- }
- Rect notificationButtonLocation = new Rect();
- mNotificationsButton.getHitRect(notificationButtonLocation);
- return notificationButtonLocation.contains((int) ev.getX(), (int) ev.getY());
- }
-
-
void setStatusBar(CarStatusBar carStatusBar) {
mCarStatusBar = carStatusBar;
}
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarNavigationButton.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarNavigationButton.java
index 9de4ef5eafcb..fc5e791ff7c5 100644
--- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarNavigationButton.java
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarNavigationButton.java
@@ -20,6 +20,7 @@ import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
+import android.os.Build;
import android.os.UserHandle;
import android.util.AttributeSet;
import android.util.Log;
@@ -114,7 +115,7 @@ public class CarNavigationButton extends com.android.keyguard.AlphaOptimizedImag
}
try {
- if (mLongIntent != null) {
+ if (mLongIntent != null && (Build.IS_ENG || Build.IS_USERDEBUG)) {
final Intent intent = Intent.parseUri(mLongIntent, Intent.URI_INTENT_SCHEME);
setOnLongClickListener(v -> {
try {
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
index 71b9dc3e923f..a452baeac5c1 100644
--- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
@@ -1248,13 +1248,6 @@ public class CarStatusBar extends StatusBar implements
setNotificationViewClipBounds((int) event2.getRawY());
return true;
}
-
- @Override
- public void onLongPress(MotionEvent e) {
- mClosingVelocity = DEFAULT_FLING_VELOCITY;
- close();
- super.onLongPress(e);
- }
}
/**
diff --git a/packages/SettingsLib/src/com/android/settingslib/net/DataUsageUtils.java b/packages/SettingsLib/src/com/android/settingslib/net/DataUsageUtils.java
index b15ea980ae15..23e2949372aa 100644
--- a/packages/SettingsLib/src/com/android/settingslib/net/DataUsageUtils.java
+++ b/packages/SettingsLib/src/com/android/settingslib/net/DataUsageUtils.java
@@ -18,11 +18,11 @@ package com.android.settingslib.net;
import android.content.Context;
import android.net.NetworkTemplate;
-import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.Log;
+import com.android.internal.util.ArrayUtils;
/**
* Utils class for data usage
*/
@@ -34,19 +34,25 @@ public class DataUsageUtils {
*/
public static NetworkTemplate getMobileTemplate(Context context, int subId) {
final TelephonyManager telephonyManager = context.getSystemService(
- TelephonyManager.class).createForSubscriptionId(subId);
+ TelephonyManager.class);
final SubscriptionManager subscriptionManager = context.getSystemService(
SubscriptionManager.class);
- final SubscriptionInfo info = subscriptionManager.getActiveSubscriptionInfo(subId);
final NetworkTemplate mobileAll = NetworkTemplate.buildTemplateMobileAll(
telephonyManager.getSubscriberId(subId));
- if (info == null) {
+ if (!subscriptionManager.isActiveSubId(subId)) {
Log.i(TAG, "Subscription is not active: " + subId);
return mobileAll;
}
- // Use old API to build networkTemplate
- return NetworkTemplate.normalize(mobileAll, telephonyManager.getMergedSubscriberIds());
+ final String[] mergedSubscriberIds = telephonyManager.createForSubscriptionId(subId)
+ .getMergedSubscriberIdsFromGroup();
+
+ if (ArrayUtils.isEmpty(mergedSubscriberIds)) {
+ Log.i(TAG, "mergedSubscriberIds is null.");
+ return mobileAll;
+ }
+
+ return NetworkTemplate.normalize(mobileAll, mergedSubscriberIds);
}
}
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/net/DataUsageUtilsTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/net/DataUsageUtilsTest.java
index 821c0b3a23f7..5cae6116a59c 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/net/DataUsageUtilsTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/net/DataUsageUtilsTest.java
@@ -18,6 +18,7 @@ package com.android.settingslib.net;
import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.Matchers.anyInt;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
@@ -37,13 +38,13 @@ import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
-import java.util.ArrayList;
import java.util.List;
@RunWith(RobolectricTestRunner.class)
public class DataUsageUtilsTest {
private static final int SUB_ID = 1;
+ private static final int SUB_ID_2 = 2;
private static final String SUBSCRIBER_ID = "Test Subscriber";
private static final String SUBSCRIBER_ID_2 = "Test Subscriber 2";
@@ -66,21 +67,28 @@ public class DataUsageUtilsTest {
mContext = spy(RuntimeEnvironment.application);
when(mContext.getSystemService(TelephonyManager.class)).thenReturn(mTelephonyManager);
- when(mTelephonyManager.createForSubscriptionId(SUB_ID)).thenReturn(mTelephonyManager);
when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
when(mTelephonyManager.getSubscriberId(SUB_ID)).thenReturn(SUBSCRIBER_ID);
- when(mTelephonyManager.getMergedSubscriberIds()).thenReturn(
- new String[]{SUBSCRIBER_ID, SUBSCRIBER_ID_2});
-
- mInfos = new ArrayList<>();
- mInfos.add(mInfo1);
- mInfos.add(mInfo2);
- when(mSubscriptionManager.getSubscriptionsInGroup(mParcelUuid)).thenReturn(mInfos);
+ when(mTelephonyManager.getSubscriberId(SUB_ID_2)).thenReturn(SUBSCRIBER_ID_2);
+ when(mTelephonyManager.createForSubscriptionId(anyInt())).thenReturn(mTelephonyManager);
+ when(mSubscriptionManager.isActiveSubId(anyInt())).thenReturn(true);
}
@Test
public void getMobileTemplate_infoNull_returnMobileAll() {
- when(mSubscriptionManager.getActiveSubscriptionInfo(SUB_ID)).thenReturn(null);
+ when(mSubscriptionManager.isActiveSubId(SUB_ID)).thenReturn(false);
+
+ final NetworkTemplate networkTemplate = DataUsageUtils.getMobileTemplate(mContext, SUB_ID);
+ assertThat(networkTemplate.matchesSubscriberId(SUBSCRIBER_ID)).isTrue();
+ assertThat(networkTemplate.matchesSubscriberId(SUBSCRIBER_ID_2)).isFalse();
+ }
+
+ @Test
+ public void getMobileTemplate_groupUuidNull_returnMobileAll() {
+ when(mSubscriptionManager.getActiveSubscriptionInfo(SUB_ID)).thenReturn(mInfo1);
+ when(mInfo1.getGroupUuid()).thenReturn(null);
+ when(mTelephonyManager.getMergedSubscriberIdsFromGroup())
+ .thenReturn(new String[] {SUBSCRIBER_ID});
final NetworkTemplate networkTemplate = DataUsageUtils.getMobileTemplate(mContext, SUB_ID);
assertThat(networkTemplate.matchesSubscriberId(SUBSCRIBER_ID)).isTrue();
@@ -88,9 +96,11 @@ public class DataUsageUtilsTest {
}
@Test
- public void getMobileTemplate_infoExisted_returnMobileMerged() {
+ public void getMobileTemplate_groupUuidExist_returnMobileMerged() {
when(mSubscriptionManager.getActiveSubscriptionInfo(SUB_ID)).thenReturn(mInfo1);
when(mInfo1.getGroupUuid()).thenReturn(mParcelUuid);
+ when(mTelephonyManager.getMergedSubscriberIdsFromGroup())
+ .thenReturn(new String[] {SUBSCRIBER_ID, SUBSCRIBER_ID_2});
final NetworkTemplate networkTemplate = DataUsageUtils.getMobileTemplate(mContext, SUB_ID);
assertThat(networkTemplate.matchesSubscriberId(SUBSCRIBER_ID)).isTrue();
diff --git a/packages/SystemUI/res-keyguard/values-bs/strings.xml b/packages/SystemUI/res-keyguard/values-bs/strings.xml
index b23824e3f8ef..8547bc87a5d3 100644
--- a/packages/SystemUI/res-keyguard/values-bs/strings.xml
+++ b/packages/SystemUI/res-keyguard/values-bs/strings.xml
@@ -22,7 +22,7 @@
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_name" msgid="3171996292755059205">"Zaključavanje tastature"</string>
<string name="keyguard_password_enter_pin_code" msgid="3420548423949593123">"Upišite PIN"</string>
- <string name="keyguard_password_enter_puk_code" msgid="670683628782925409">"Upišite PUK kôd za SIM karticu i novi PIN"</string>
+ <string name="keyguard_password_enter_puk_code" msgid="670683628782925409">"Upišite PUK za SIM i novi PIN kôd"</string>
<string name="keyguard_password_enter_puk_prompt" msgid="3747778500166059332">"PUK kôd za SIM karticu"</string>
<string name="keyguard_password_enter_pin_prompt" msgid="8188243197504453830">"Novi PIN za SIM karticu"</string>
<string name="keyguard_password_entry_touch_hint" msgid="5790410752696806482"><font size="17">"Dodirnite da upišete lozinku"</font></string>
@@ -54,7 +54,7 @@
<string name="keyguard_accessibility_pin_area" msgid="703175752097279029">"Prostor za PIN"</string>
<string name="keyguard_accessibility_password" msgid="7695303207740941101">"Lozinka uređaja"</string>
<string name="keyguard_accessibility_sim_pin_area" msgid="912702510825058921">"Prostor za PIN za SIM karticu"</string>
- <string name="keyguard_accessibility_sim_puk_area" msgid="136979425761438705">"Prostor za PUK kôd za SIM karticu"</string>
+ <string name="keyguard_accessibility_sim_puk_area" msgid="136979425761438705">"Prostor za PUK za SIM"</string>
<string name="keyguard_accessibility_next_alarm" msgid="5835196989158584991">"Naredni alarm je podešen za <xliff:g id="ALARM">%1$s</xliff:g>"</string>
<string name="keyboardview_keycode_delete" msgid="6883116827512721630">"Izbriši"</string>
<string name="disable_carrier_button_text" msgid="6914341927421916114">"Onemogući eSIM karticu"</string>
@@ -116,7 +116,7 @@
<item quantity="other">PUK kôd za SIM karticu je netačan. Imate još <xliff:g id="NUMBER_1">%d</xliff:g> pokušaja prije nego što SIM kartica postane trajno neupotrebljiva.</item>
</plurals>
<string name="kg_password_pin_failed" msgid="8769990811451236223">"Korištenje PIN-a za SIM karticu nije uspjelo!"</string>
- <string name="kg_password_puk_failed" msgid="1331621440873439974">"Korištenje PUK koda za SIM karticu nije uspjelo!"</string>
+ <string name="kg_password_puk_failed" msgid="1331621440873439974">"Korištenje PUK-a za SIM nije uspjelo!"</string>
<string name="kg_pin_accepted" msgid="7637293533973802143">"Kôd je prihvaćen"</string>
<string name="keyguard_carrier_default" msgid="4274828292998453695">"Nema mreže."</string>
<string name="accessibility_ime_switch_button" msgid="2695096475319405612">"Promjena načina unosa"</string>
diff --git a/packages/SystemUI/res-keyguard/values-sq/strings.xml b/packages/SystemUI/res-keyguard/values-sq/strings.xml
index 1d42f1f8b5ab..e4b37d0f1119 100644
--- a/packages/SystemUI/res-keyguard/values-sq/strings.xml
+++ b/packages/SystemUI/res-keyguard/values-sq/strings.xml
@@ -38,7 +38,7 @@
<string name="keyguard_plugged_in" msgid="3161102098900158923">"<xliff:g id="PERCENTAGE">%s</xliff:g> • Po karikohet"</string>
<string name="keyguard_plugged_in_charging_fast" msgid="3684592786276709342">"<xliff:g id="PERCENTAGE">%s</xliff:g> • Po karikohet me shpejtësi"</string>
<string name="keyguard_plugged_in_charging_slowly" msgid="509533586841478405">"<xliff:g id="PERCENTAGE">%s</xliff:g> • Po karikohet ngadalë"</string>
- <string name="keyguard_low_battery" msgid="9218432555787624490">"Lidh ngarkuesin."</string>
+ <string name="keyguard_low_battery" msgid="9218432555787624490">"Lidh karikuesin."</string>
<string name="keyguard_instructions_when_pattern_disabled" msgid="8566679946700751371">"Shtyp \"Meny\" për të shkyçur."</string>
<string name="keyguard_network_locked_message" msgid="6743537524631420759">"Rrjeti është i kyçur"</string>
<string name="keyguard_missing_sim_message_short" msgid="6327533369959764518">"Nuk ka kartë SIM"</string>
diff --git a/packages/SystemUI/res/values-ar/strings.xml b/packages/SystemUI/res/values-ar/strings.xml
index 7f85ec0dee6e..3d297aee1cc2 100644
--- a/packages/SystemUI/res/values-ar/strings.xml
+++ b/packages/SystemUI/res/values-ar/strings.xml
@@ -464,7 +464,7 @@
<string name="battery_saver_notification_title" msgid="8614079794522291840">"تم تفعيل ميزة توفير شحن البطارية"</string>
<string name="battery_saver_notification_text" msgid="820318788126672692">"لخفض مستوى الأداء وبيانات الخلفية"</string>
<string name="battery_saver_notification_action_text" msgid="132118784269455533">"إيقاف ميزة توفير شحن البطارية"</string>
- <string name="media_projection_dialog_text" msgid="8585357687598538511">"أثناء التسجيل أو الإرسال، يمكن لتطبيق <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> تسجيل أي معلومات حساسة يتم عرضها على الشاشة أو تشغيلها من جهازك، بما فيها المعلومات الحساسة مثل الصوت الذي تشغّله وكلمات المرور ومعلومات الدفع والصور والرسائل."</string>
+ <string name="media_projection_dialog_text" msgid="8585357687598538511">"أثناء التسجيل أو البث، يمكن لتطبيق <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> تسجيل أي معلومات حسّاسة يتم عرضها على الشاشة أو تشغيلها من جهازك، بما فيها المعلومات الحسّاسة مثل المقاطع الصوتية وكلمات المرور ومعلومات الدفع والصور والرسائل."</string>
<string name="media_projection_dialog_service_text" msgid="3075544489835858258">"أثناء التسجيل أو الإرسال، يمكن للخدمة التي تقدّم هذه الوظيفة تسجيل أي معلومات حساسة يتم عرضها على الشاشة أو تشغيلها من جهازك، بما فيها المعلومات الحساسة مثل الصوت الذي تشغّله وكلمات المرور ومعلومات الدفع والصور والرسائل."</string>
<string name="media_projection_dialog_title" msgid="8124184308671641248">"عرض معلومات حسّاسة أثناء الإرسال/التسجيل"</string>
<string name="media_projection_remember_text" msgid="3103510882172746752">"عدم الإظهار مرة أخرى"</string>
diff --git a/packages/SystemUI/res/values-eu/strings.xml b/packages/SystemUI/res/values-eu/strings.xml
index a5f998914cec..7b2d7936d5ef 100644
--- a/packages/SystemUI/res/values-eu/strings.xml
+++ b/packages/SystemUI/res/values-eu/strings.xml
@@ -871,7 +871,7 @@
<string name="notification_channel_storage" msgid="3077205683020695313">"Memoria"</string>
<string name="notification_channel_hints" msgid="7323870212489152689">"Aholkuak"</string>
<string name="instant_apps" msgid="6647570248119804907">"Zuzeneko aplikazioak"</string>
- <string name="instant_apps_title" msgid="8738419517367449783">"<xliff:g id="APP">%1$s</xliff:g> exekutatzen ari da"</string>
+ <string name="instant_apps_title" msgid="8738419517367449783">"<xliff:g id="APP">%1$s</xliff:g> abian da"</string>
<string name="instant_apps_message" msgid="1183313016396018086">"Ezer instalatu gabe ireki da aplikazioa."</string>
<string name="instant_apps_message_with_help" msgid="6179830437630729747">"Ezer instalatu gabe ireki da aplikazioa. Sakatu informazio gehiago lortzeko."</string>
<string name="app_info" msgid="6856026610594615344">"Aplikazioari buruzko informazioa"</string>
@@ -888,7 +888,7 @@
<string name="qs_dnd_until" msgid="3469471136280079874">"<xliff:g id="ID_1">%s</xliff:g> arte"</string>
<string name="qs_dnd_keep" msgid="1825009164681928736">"Utzi bere horretan"</string>
<string name="qs_dnd_replace" msgid="8019520786644276623">"Ordeztu"</string>
- <string name="running_foreground_services_title" msgid="381024150898615683">"Aplikazioak exekutatzen ari dira atzeko planoan"</string>
+ <string name="running_foreground_services_title" msgid="381024150898615683">"Aplikazioak abian dira atzeko planoan"</string>
<string name="running_foreground_services_msg" msgid="6326247670075574355">"Sakatu bateria eta datuen erabilerari buruzko xehetasunak ikusteko"</string>
<string name="mobile_data_disable_title" msgid="1068272097382942231">"Datu-konexioa desaktibatu nahi duzu?"</string>
<string name="mobile_data_disable_message" msgid="4756541658791493506">"<xliff:g id="CARRIER">%s</xliff:g> erabilita ezingo dituzu erabili datuak edo Internet. Wifi-sare baten bidez soilik konektatu ahal izango zara Internetera."</string>
diff --git a/packages/SystemUI/res/values-hi/strings.xml b/packages/SystemUI/res/values-hi/strings.xml
index ef29f9bfd0a4..263fe8a31a9a 100644
--- a/packages/SystemUI/res/values-hi/strings.xml
+++ b/packages/SystemUI/res/values-hi/strings.xml
@@ -484,7 +484,7 @@
<string name="monitoring_title_device_owned" msgid="1652495295941959815">"डिवाइस प्रबंधन"</string>
<string name="monitoring_title_profile_owned" msgid="6790109874733501487">"प्रोफ़ाइल को मॉनीटर करना"</string>
<string name="monitoring_title" msgid="169206259253048106">"नेटवर्क को मॉनीटर करना"</string>
- <string name="monitoring_subtitle_vpn" msgid="876537538087857300">"VPN"</string>
+ <string name="monitoring_subtitle_vpn" msgid="876537538087857300">"वीपीएन"</string>
<string name="monitoring_subtitle_network_logging" msgid="3341264304793193386">"नेटवर्क लॉगिंग"</string>
<string name="monitoring_subtitle_ca_certificate" msgid="3874151893894355988">"CA प्रमाणपत्र"</string>
<string name="disable_vpn" msgid="4435534311510272506">"VPN अक्षम करें"</string>
@@ -513,7 +513,7 @@
<string name="monitoring_description_network_logging" msgid="7223505523384076027">"आपके एडमिन ने नेटवर्क लॉग करना चालू कर दिया है, जो आपके डिवाइस पर ट्रैफ़िक की निगरानी करता है.\n\nज़्यादा जानकारी के लिए अपने एडमिन से संपर्क करें."</string>
<string name="monitoring_description_vpn" msgid="4445150119515393526">"आपने किसी ऐप को VPN कनेक्‍शन सेट करने की अनुमति दी है.\n\nयह ऐप ईमेल, ऐप्‍स और सुरक्षित वेबसाइटों सहित आपके डिवाइस और नेटवर्क की गतिविधि की निगरानी कर सकता है."</string>
<string name="monitoring_description_vpn_profile_owned" msgid="2958019119161161530">"<xliff:g id="ORGANIZATION">%1$s</xliff:g> आपकी वर्क प्रोफ़ाइल को प्रबंधित करता है.\n\n आपका एडमिन ईमेल, ऐप्लिकेशन और वेबसाइटों सहित आपकी नेटवर्क गतिविधि की निगरानी कर सकता है.\n\nऔर जानकारी के लिए अपने एडमिन से संपर्क करें.\n\nआप ऐसे VPN से भी कनेक्‍ट हैं, जो आपकी नेटवर्क गतिविधि की निगरानी कर सकता है."</string>
- <string name="legacy_vpn_name" msgid="6604123105765737830">"VPN"</string>
+ <string name="legacy_vpn_name" msgid="6604123105765737830">"वीपीएन"</string>
<string name="monitoring_description_app" msgid="1828472472674709532">"आप <xliff:g id="APPLICATION">%1$s</xliff:g> से कनेक्ट हैं, जो ईमेल, ऐप्लिकेशन और वेबसाइटों सहित आपकी नेटवर्क गतिविधि की निगरानी कर सकता है."</string>
<string name="monitoring_description_app_personal" msgid="484599052118316268">"आप <xliff:g id="APPLICATION">%1$s</xliff:g> से कनेक्‍ट हैं, जो ईमेल, ऐप्‍स और वेबसाइटों सहित आपकी व्‍यक्‍तिगत नेटवर्क गतिविधि की निगरानी कर सकता है."</string>
<string name="branded_monitoring_description_app_personal" msgid="2669518213949202599">"आप <xliff:g id="APPLICATION">%1$s</xliff:g> से कनेक्‍ट हैं, जो ईमेल, ऐप्लिकेशन और वेबसाइट सहित आपकी व्‍यक्‍तिगत नेटवर्क गतिविधि को मॉनिटर कर सकता है."</string>
diff --git a/packages/SystemUI/res/values-hy/strings.xml b/packages/SystemUI/res/values-hy/strings.xml
index 6d614b1e3f45..3156a6f6fda2 100644
--- a/packages/SystemUI/res/values-hy/strings.xml
+++ b/packages/SystemUI/res/values-hy/strings.xml
@@ -130,7 +130,7 @@
<string name="face_dialog_looking_for_face" msgid="7049276266074494689">"Դեմքի ճանաչում…"</string>
<string name="accessibility_face_dialog_face_icon" msgid="2658119009870383490">"Դեմքի պատկերակ"</string>
<string name="accessibility_compatibility_zoom_button" msgid="8461115318742350699">"Համատեղելիության խոշորացման կոճակը:"</string>
- <string name="accessibility_compatibility_zoom_example" msgid="4220687294564945780">"Դիտափոխել փոքրից ավելի մեծ էկրան:"</string>
+ <string name="accessibility_compatibility_zoom_example" msgid="4220687294564945780">"Մասշտաբը մեծացնել փոքրից ավելի մեծ էկրան:"</string>
<string name="accessibility_bluetooth_connected" msgid="2707027633242983370">"Bluetooth-ը միացված է:"</string>
<string name="accessibility_bluetooth_disconnected" msgid="7416648669976870175">"Bluetooth-ն անջատված է:"</string>
<string name="accessibility_no_battery" msgid="358343022352820946">"Մարտկոց չկա:"</string>
diff --git a/packages/SystemUI/res/values-in/strings.xml b/packages/SystemUI/res/values-in/strings.xml
index 59b6eb3b98e7..19b2b99344a6 100644
--- a/packages/SystemUI/res/values-in/strings.xml
+++ b/packages/SystemUI/res/values-in/strings.xml
@@ -89,7 +89,7 @@
<string name="screenrecord_share_label" msgid="4197867360204019389">"Bagikan"</string>
<string name="screenrecord_delete_label" msgid="7893716870917824013">"Hapus"</string>
<string name="screenrecord_cancel_success" msgid="7768976011702614782">"Rekaman layar dibatalkan"</string>
- <string name="screenrecord_save_message" msgid="4733982661301846778">"Rekaman layar disimpan, tap untuk melihat"</string>
+ <string name="screenrecord_save_message" msgid="4733982661301846778">"Rekaman layar disimpan, ketuk untuk melihat"</string>
<string name="screenrecord_delete_description" msgid="5743190456090354585">"Rekaman layar dihapus"</string>
<string name="screenrecord_delete_error" msgid="8154904464563560282">"Error saat menghapus rekaman layar"</string>
<string name="screenrecord_permission_error" msgid="1526755299469001000">"Gagal mendapatkan izin"</string>
@@ -836,7 +836,7 @@
<string name="pip_phone_dismiss_hint" msgid="6351678169095923899">"Tarik ke bawah untuk menutup"</string>
<string name="pip_menu_title" msgid="4707292089961887657">"Menu"</string>
<string name="pip_notification_title" msgid="3204024940158161322">"<xliff:g id="NAME">%s</xliff:g> adalah picture-in-picture"</string>
- <string name="pip_notification_message" msgid="5619512781514343311">"Jika Anda tidak ingin <xliff:g id="NAME">%s</xliff:g> menggunakan fitur ini, tap untuk membuka setelan dan menonaktifkannya."</string>
+ <string name="pip_notification_message" msgid="5619512781514343311">"Jika Anda tidak ingin <xliff:g id="NAME">%s</xliff:g> menggunakan fitur ini, ketuk untuk membuka setelan dan menonaktifkannya."</string>
<string name="pip_play" msgid="1417176722760265888">"Putar"</string>
<string name="pip_pause" msgid="8881063404466476571">"Jeda"</string>
<string name="pip_skip_to_next" msgid="1948440006726306284">"Lewati ke berikutnya"</string>
diff --git a/packages/SystemUI/res/values-sq/strings.xml b/packages/SystemUI/res/values-sq/strings.xml
index 1058d74ab2b1..08816c7d51e4 100644
--- a/packages/SystemUI/res/values-sq/strings.xml
+++ b/packages/SystemUI/res/values-sq/strings.xml
@@ -29,9 +29,9 @@
<string name="battery_low_percent_format_hybrid" msgid="6838677459286775617">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> të mbetura, rreth <xliff:g id="TIME">%2$s</xliff:g> të mbetura bazuar në përdorimin tënd"</string>
<string name="battery_low_percent_format_hybrid_short" msgid="9025795469949145586">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> të mbetura, rreth <xliff:g id="TIME">%2$s</xliff:g> të mbetura"</string>
<string name="battery_low_percent_format_saver_started" msgid="7879389868952879166">"Ka mbetur edhe <xliff:g id="PERCENTAGE">%s</xliff:g>. \"Kursyesi i baterisë\" është i aktivizuar."</string>
- <string name="invalid_charger" msgid="2741987096648693172">"Nuk mund të ngarkohet përmes USB-së. Përdor ngarkuesin që ke marrë me pajisjen."</string>
+ <string name="invalid_charger" msgid="2741987096648693172">"Nuk mund të karikohet përmes USB-së. Përdor karikuesin që ke marrë me pajisjen."</string>
<string name="invalid_charger_title" msgid="2836102177577255404">"Nuk mund të ngarkohet përmes USB-së"</string>
- <string name="invalid_charger_text" msgid="6480624964117840005">"Përdor ngarkuesin që ke marrë me pajisjen"</string>
+ <string name="invalid_charger_text" msgid="6480624964117840005">"Përdor karikuesin që ke marrë me pajisjen"</string>
<string name="battery_low_why" msgid="4553600287639198111">"Cilësimet"</string>
<string name="battery_saver_confirmation_title" msgid="2052100465684817154">"Të aktivizohet \"Kursyesi i baterisë\"?"</string>
<string name="battery_saver_confirmation_title_generic" msgid="2090922638411744540">"Rreth \"Kursyesit të baterisë\""</string>
diff --git a/packages/SystemUI/res/values-uk/strings.xml b/packages/SystemUI/res/values-uk/strings.xml
index 0e74993874d4..56521f6eb1aa 100644
--- a/packages/SystemUI/res/values-uk/strings.xml
+++ b/packages/SystemUI/res/values-uk/strings.xml
@@ -33,7 +33,7 @@
<string name="invalid_charger_title" msgid="2836102177577255404">"Не вдається зарядити через USB"</string>
<string name="invalid_charger_text" msgid="6480624964117840005">"Використовуйте зарядний пристрій, який входить у комплект пристрою"</string>
<string name="battery_low_why" msgid="4553600287639198111">"Налаштування"</string>
- <string name="battery_saver_confirmation_title" msgid="2052100465684817154">"Увімкнути режим економії заряду акумулятора?"</string>
+ <string name="battery_saver_confirmation_title" msgid="2052100465684817154">"Увімкнути режим енергозбереження?"</string>
<string name="battery_saver_confirmation_title_generic" msgid="2090922638411744540">"Про режим енергозбереження"</string>
<string name="battery_saver_confirmation_ok" msgid="7507968430447930257">"Увімкнути"</string>
<string name="battery_saver_start_action" msgid="8187820911065797519">"Увімкнути режим економії заряду акумулятора"</string>
@@ -455,7 +455,7 @@
<string name="user_remove_user_title" msgid="4681256956076895559">"Видалити користувача?"</string>
<string name="user_remove_user_message" msgid="1453218013959498039">"Усі додатки й дані цього користувача буде видалено."</string>
<string name="user_remove_user_remove" msgid="7479275741742178297">"Видалити"</string>
- <string name="battery_saver_notification_title" msgid="8614079794522291840">"Режим економії заряду акумулятора ввімкнено"</string>
+ <string name="battery_saver_notification_title" msgid="8614079794522291840">"Режим енергозбереження ввімкнено"</string>
<string name="battery_saver_notification_text" msgid="820318788126672692">"Знижується продуктивність і обмежуються фонові дані"</string>
<string name="battery_saver_notification_action_text" msgid="132118784269455533">"Вимкнути режим економії заряду акумулятора"</string>
<string name="media_projection_dialog_text" msgid="8585357687598538511">"Під час запису або трансляції додаток <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> може фіксувати будь-яку конфіденційну інформацію (зокрема, аудіо, паролі, платіжну інформацію, фотографії та повідомлення), яка з\'являється на екрані або відтворюється на пристрої."</string>
@@ -913,7 +913,7 @@
<string name="auto_saver_title" msgid="1217959994732964228">"Торкніться, щоб увімкнути автоматичний режим економії заряду акумулятора"</string>
<string name="auto_saver_text" msgid="2563289953551438248">"Вмикати, коли заряд акумулятора закінчується"</string>
<string name="no_auto_saver_action" msgid="8086002101711328500">"Ні, дякую"</string>
- <string name="auto_saver_enabled_title" msgid="6726474226058316862">"Автоматичний режим економії заряду акумулятора ввімкнено"</string>
+ <string name="auto_saver_enabled_title" msgid="6726474226058316862">"Автоматичний перехід у режим енергозбереження ввімкнено"</string>
<string name="auto_saver_enabled_text" msgid="874711029884777579">"Режим економії заряду акумулятора вмикається автоматично, коли рівень заряду нижчий за <xliff:g id="PERCENTAGE">%d</xliff:g>%%."</string>
<string name="open_saver_setting_action" msgid="8314624730997322529">"Налаштування"</string>
<string name="auto_saver_okay_action" msgid="2701221740227683650">"OK"</string>
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/Task.java b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/Task.java
index 5b9ee1c47e87..dcb134ec933e 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/Task.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/Task.java
@@ -20,6 +20,7 @@ import static android.view.Display.DEFAULT_DISPLAY;
import android.app.ActivityManager;
import android.app.ActivityManager.TaskDescription;
+import android.app.TaskInfo;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.ActivityInfo;
@@ -75,7 +76,7 @@ public class Task {
private int mHashCode;
- public TaskKey(ActivityManager.RecentTaskInfo t) {
+ public TaskKey(TaskInfo t) {
ComponentName sourceComponent = t.origActivity != null
// Activity alias if there is one
? t.origActivity
@@ -226,6 +227,17 @@ public class Task {
// Do nothing
}
+ /**
+ * Creates a task object from the provided task info
+ */
+ public static Task from(TaskKey taskKey, TaskInfo taskInfo, boolean isLocked) {
+ ActivityManager.TaskDescription td = taskInfo.taskDescription;
+ return new Task(taskKey,
+ td != null ? td.getPrimaryColor() : 0,
+ td != null ? td.getBackgroundColor() : 0,
+ taskInfo.supportsSplitScreenMultiWindow, isLocked, td, taskInfo.topActivity);
+ }
+
public Task(TaskKey key) {
this.key = key;
this.taskDescription = new TaskDescription();
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 506813beadf6..328116dc3c1b 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
@@ -30,10 +30,12 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import android.annotation.NonNull;
import android.app.ActivityManager;
import android.app.ActivityManager.RecentTaskInfo;
+import android.app.ActivityManager.RunningTaskInfo;
import android.app.ActivityOptions;
import android.app.ActivityTaskManager;
import android.app.AppGlobals;
import android.app.IAssistDataReceiver;
+import android.app.WindowConfiguration;
import android.app.WindowConfiguration.ActivityType;
import android.content.ContentResolver;
import android.content.Context;
@@ -500,4 +502,12 @@ public class ActivityManagerWrapper {
PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT)
|| freeformDevOption);
}
+
+ /**
+ * Returns true if the running task represents the home task
+ */
+ public static boolean isHomeTask(RunningTaskInfo info) {
+ return info.configuration.windowConfiguration.getActivityType()
+ == WindowConfiguration.ACTIVITY_TYPE_HOME;
+ }
}
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java
index 7fbe5db99569..cc7863c0113b 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java
@@ -49,6 +49,15 @@ public class QuickStepContract {
public static final String NAV_BAR_MODE_GESTURAL_OVERLAY =
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY;
+ // Action sent by a system app to switch to gesture nav
+ public static final String ACTION_ENABLE_GESTURE_NAV =
+ "com.android.systemui.ENABLE_GESTURE_NAV";
+ // Action for the intent to receive the result
+ public static final String ACTION_ENABLE_GESTURE_NAV_RESULT =
+ "com.android.systemui.action.ENABLE_GESTURE_NAV_RESULT";
+ // Extra containing the pending intent to receive the result
+ public static final String EXTRA_RESULT_INTENT = "com.android.systemui.EXTRA_RESULT_INTENT";
+
// Overview is disabled, either because the device is in lock task mode, or because the device
// policy has disabled the feature
public static final int SYSUI_STATE_SCREEN_PINNING = 1 << 0;
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerImpl.java b/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerImpl.java
index 6fb6467d07b2..67dfdcac4b22 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerImpl.java
@@ -67,8 +67,8 @@ public class FalsingManagerImpl implements FalsingManager {
Sensor.TYPE_LIGHT,
Sensor.TYPE_ROTATION_VECTOR,
};
- private static final String FALSING_REMAIN_LOCKED = "falsing_failure_after_attempts";
- private static final String FALSING_SUCCESS = "falsing_success_after_attempts";
+ public static final String FALSING_REMAIN_LOCKED = "falsing_failure_after_attempts";
+ public static final String FALSING_SUCCESS = "falsing_success_after_attempts";
private final Handler mHandler = new Handler(Looper.getMainLooper());
private final Context mContext;
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/brightline/BrightLineFalsingManager.java b/packages/SystemUI/src/com/android/systemui/classifier/brightline/BrightLineFalsingManager.java
index 19c46e40f604..00f35aa4276c 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/brightline/BrightLineFalsingManager.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/brightline/BrightLineFalsingManager.java
@@ -16,6 +16,9 @@
package com.android.systemui.classifier.brightline;
+import static com.android.systemui.classifier.FalsingManagerImpl.FALSING_REMAIN_LOCKED;
+import static com.android.systemui.classifier.FalsingManagerImpl.FALSING_SUCCESS;
+
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
@@ -24,6 +27,7 @@ import android.net.Uri;
import android.util.Log;
import android.view.MotionEvent;
+import com.android.internal.logging.MetricsLogger;
import com.android.systemui.classifier.Classifier;
import com.android.systemui.plugins.FalsingManager;
@@ -44,6 +48,8 @@ public class BrightLineFalsingManager implements FalsingManager {
private final SensorManager mSensorManager;
private final FalsingDataProvider mDataProvider;
private boolean mSessionStarted;
+ private MetricsLogger mMetricsLogger;
+ private int mIsFalseTouchCalls;
private final ExecutorService mBackgroundExecutor = Executors.newSingleThreadExecutor();
@@ -64,6 +70,7 @@ public class BrightLineFalsingManager implements FalsingManager {
SensorManager sensorManager) {
mDataProvider = falsingDataProvider;
mSensorManager = sensorManager;
+ mMetricsLogger = new MetricsLogger();
mClassifiers = new ArrayList<>();
DistanceClassifier distanceClassifier = new DistanceClassifier(mDataProvider);
ProximityClassifier proximityClassifier = new ProximityClassifier(distanceClassifier,
@@ -111,6 +118,10 @@ public class BrightLineFalsingManager implements FalsingManager {
unregisterSensors();
mDataProvider.onSessionEnd();
mClassifiers.forEach(FalsingClassifier::onSessionEnded);
+ if (mIsFalseTouchCalls != 0) {
+ mMetricsLogger.histogram(FALSING_REMAIN_LOCKED, mIsFalseTouchCalls);
+ mIsFalseTouchCalls = 0;
+ }
}
}
@@ -157,6 +168,10 @@ public class BrightLineFalsingManager implements FalsingManager {
@Override
public void onSucccessfulUnlock() {
+ if (mIsFalseTouchCalls != 0) {
+ mMetricsLogger.histogram(FALSING_SUCCESS, mIsFalseTouchCalls);
+ mIsFalseTouchCalls = 0;
+ }
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java
index 70ee752dd8ed..c9050d492191 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java
@@ -398,7 +398,7 @@ public class NotificationRemoteInputManager implements Dumpable {
}
}
- if (!riv.isAttachedToWindow()) {
+ if (riv != null && !riv.isAttachedToWindow()) {
// the remoteInput isn't attached to the window anymore :/ Let's focus on the expanded
// one instead if it's available
riv = null;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java
index 35ba801c75ba..01e2b28600db 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java
@@ -514,11 +514,11 @@ public class StackScrollAlgorithm {
for (int i = 0; i < childCount; i++) {
View child = algorithmState.visibleChildren.get(i);
if (!(child instanceof ExpandableNotificationRow)) {
- break;
+ continue;
}
ExpandableNotificationRow row = (ExpandableNotificationRow) child;
if (!row.isHeadsUp()) {
- break;
+ continue;
}
ExpandableViewState childState = row.getViewState();
if (topHeadsUpEntry == null && row.mustStayOnScreen() && !childState.headsUpIsVisible) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
index 05d26b0a6a17..bc7174d33b13 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
@@ -261,6 +261,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
biometricSourceType);
if (unlockAllowed) {
startWakeAndUnlock(biometricSourceType);
+ } else {
+ Log.d(TAG, "onBiometricAuthenticated aborted by bypass controller");
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
index 21a22eccf509..d6f8a606af55 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
@@ -346,10 +346,10 @@ public class KeyguardBouncer {
}
/**
- * {@link #show(boolean)} was called but we're not showing yet.
+ * {@link #show(boolean)} was called but we're not showing yet, or being dragged.
*/
- public boolean willShowSoon() {
- return mShowingSoon;
+ public boolean inTransit() {
+ return mShowingSoon || mExpansion != EXPANSION_HIDDEN;
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt
index d7deedce3c2f..c88b22bbbced 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt
@@ -21,11 +21,11 @@ import android.content.pm.PackageManager
import android.hardware.biometrics.BiometricSourceType
import android.hardware.face.FaceManager
import android.provider.Settings
-import com.android.keyguard.KeyguardUpdateMonitor
import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.statusbar.NotificationLockscreenUserManager
import com.android.systemui.statusbar.StatusBarState
import com.android.systemui.tuner.TunerService
+import java.io.PrintWriter
import javax.inject.Inject
import javax.inject.Singleton
@@ -62,18 +62,15 @@ class KeyguardBypassController {
}
@Inject
- constructor(context: Context, tunerService: TunerService,
- statusBarStateController: StatusBarStateController,
- lockscreenUserManager: NotificationLockscreenUserManager) {
+ constructor(
+ context: Context,
+ tunerService: TunerService,
+ statusBarStateController: StatusBarStateController,
+ lockscreenUserManager: NotificationLockscreenUserManager
+ ) {
unlockMethodCache = UnlockMethodCache.getInstance(context)
this.statusBarStateController = statusBarStateController
- statusBarStateController.addCallback(object : StatusBarStateController.StateListener {
- override fun onStateChanged(newState: Int) {
- if (newState != StatusBarState.KEYGUARD) {
- pendingUnlockType = null;
- }
- }
- })
+
if (!context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE)) {
return
}
@@ -82,16 +79,19 @@ class KeyguardBypassController {
return
}
+ statusBarStateController.addCallback(object : StatusBarStateController.StateListener {
+ override fun onStateChanged(newState: Int) {
+ if (newState != StatusBarState.KEYGUARD) {
+ pendingUnlockType = null
+ }
+ }
+ })
+
val dismissByDefault = if (context.resources.getBoolean(
- com.android.internal.R.bool.config_faceAuthDismissesKeyguard)) 1 else 0
- tunerService.addTunable(
- object : TunerService.Tunable {
- override fun onTuningChanged(key: String?, newValue: String?) {
- bypassEnabled = Settings.Secure.getIntForUser(
- context.contentResolver,
- Settings.Secure.FACE_UNLOCK_DISMISSES_KEYGUARD,
- dismissByDefault,
- KeyguardUpdateMonitor.getCurrentUser()) != 0
+ com.android.internal.R.bool.config_faceAuthDismissesKeyguard)) 1 else 0
+ tunerService.addTunable(object : TunerService.Tunable {
+ override fun onTuningChanged(key: String?, newValue: String?) {
+ bypassEnabled = tunerService.getValue(key, dismissByDefault) != 0
}
}, Settings.Secure.FACE_UNLOCK_DISMISSES_KEYGUARD)
lockscreenUserManager.addUserChangedListener { pendingUnlockType = null }
@@ -155,4 +155,16 @@ class KeyguardBypassController {
fun onStartedGoingToSleep() {
pendingUnlockType = null
}
+
+ fun dump(pw: PrintWriter) {
+ pw.println("KeyguardBypassController:")
+ pw.print(" pendingUnlockType: "); pw.println(pendingUnlockType)
+ pw.print(" bypassEnabled: "); pw.println(bypassEnabled)
+ pw.print(" canBypass: "); pw.println(canBypass())
+ pw.print(" bouncerShowing: "); pw.println(bouncerShowing)
+ pw.print(" isPulseExpanding: "); pw.println(isPulseExpanding)
+ pw.print(" launchingAffordance: "); pw.println(launchingAffordance)
+ pw.print(" qSExpanded: "); pw.println(qSExpanded)
+ pw.print(" bouncerShowing: "); pw.println(bouncerShowing)
+ }
}
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 4d7cf2715f9c..64fef55a21d3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java
@@ -16,17 +16,26 @@
package com.android.systemui.statusbar.phone;
+import static android.app.Activity.RESULT_CANCELED;
+import static android.app.Activity.RESULT_OK;
+import static android.app.admin.DevicePolicyManager.STATE_USER_UNMANAGED;
import static android.content.Intent.ACTION_OVERLAY_CHANGED;
import static android.content.Intent.ACTION_PREFERRED_ACTIVITY_CHANGED;
+import static android.content.pm.PackageManager.FEATURE_DEVICE_ADMIN;
import static android.os.UserHandle.USER_CURRENT;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY;
+import static com.android.systemui.shared.system.QuickStepContract.ACTION_ENABLE_GESTURE_NAV;
+import static com.android.systemui.shared.system.QuickStepContract.ACTION_ENABLE_GESTURE_NAV_RESULT;
+import static com.android.systemui.shared.system.QuickStepContract.EXTRA_RESULT_INTENT;
+
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
+import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
@@ -40,6 +49,7 @@ import android.os.PatternMatcher;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
+import android.os.UserManager;
import android.provider.Settings;
import android.provider.Settings.Secure;
import android.text.TextUtils;
@@ -157,6 +167,8 @@ public class NavigationModeController implements Dumpable {
}
};
+ private BroadcastReceiver mEnableGestureNavReceiver;
+
@Inject
public NavigationModeController(Context context,
DeviceProvisionedController deviceProvisionedController,
@@ -177,6 +189,7 @@ public class NavigationModeController implements Dumpable {
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);
@@ -187,6 +200,82 @@ public class NavigationModeController implements Dumpable {
deferGesturalNavOverlayIfNecessary();
}
+ private void removeEnableGestureNavListener() {
+ if (mEnableGestureNavReceiver != null) {
+ if (DEBUG) {
+ Log.d(TAG, "mEnableGestureNavReceiver unregistered");
+ }
+ mContext.unregisterReceiver(mEnableGestureNavReceiver);
+ mEnableGestureNavReceiver = null;
+ }
+ }
+
+ private boolean setGestureModeOverlayForMainLauncher() {
+ removeEnableGestureNavListener();
+ if (getCurrentInteractionMode(mCurrentUserContext) == NAV_BAR_MODE_GESTURAL) {
+ // Already in gesture mode
+ return true;
+ }
+ final Boolean supported = isGestureNavSupportedByDefaultLauncher(mCurrentUserContext);
+ if (supported == null || supported) {
+ Log.d(TAG, "Switching system navigation to full-gesture mode:"
+ + " defaultLauncher="
+ + getDefaultLauncherPackageName(mCurrentUserContext)
+ + " contextUser="
+ + mCurrentUserContext.getUserId());
+
+ setModeOverlay(NAV_BAR_MODE_GESTURAL_OVERLAY, USER_CURRENT);
+ return true;
+ } else {
+ Log.e(TAG, "Gesture nav is not supported for defaultLauncher="
+ + getDefaultLauncherPackageName(mCurrentUserContext));
+ return false;
+ }
+ }
+
+ private boolean enableGestureNav(Intent intent) {
+ if (!(intent.getParcelableExtra(EXTRA_RESULT_INTENT) instanceof PendingIntent)) {
+ Log.e(TAG, "No callback pending intent was attached");
+ return false;
+ }
+
+ PendingIntent callback = intent.getParcelableExtra(EXTRA_RESULT_INTENT);
+ Intent callbackIntent = callback.getIntent();
+ if (callbackIntent == null
+ || !ACTION_ENABLE_GESTURE_NAV_RESULT.equals(callbackIntent.getAction())) {
+ Log.e(TAG, "Invalid callback intent");
+ return false;
+ }
+ String callerPackage = callback.getCreatorPackage();
+ UserHandle callerUser = callback.getCreatorUserHandle();
+
+ DevicePolicyManager dpm = mCurrentUserContext.getSystemService(DevicePolicyManager.class);
+ ComponentName ownerComponent = dpm.getDeviceOwnerComponentOnCallingUser();
+
+ if (ownerComponent != null) {
+ // Verify that the caller is the owner component
+ if (!ownerComponent.getPackageName().equals(callerPackage)
+ || !mCurrentUserContext.getUser().equals(callerUser)) {
+ Log.e(TAG, "Callback must be from the device owner");
+ return false;
+ }
+ } else {
+ UserHandle callerParent = mCurrentUserContext.getSystemService(UserManager.class)
+ .getProfileParent(callerUser);
+ if (callerParent == null || !callerParent.equals(mCurrentUserContext.getUser())) {
+ Log.e(TAG, "Callback must be from a managed user");
+ return false;
+ }
+ ComponentName profileOwner = dpm.getProfileOwnerAsUser(callerUser);
+ if (profileOwner == null || !profileOwner.getPackageName().equals(callerPackage)) {
+ Log.e(TAG, "Callback must be from the profile owner");
+ return false;
+ }
+ }
+
+ return setGestureModeOverlayForMainLauncher();
+ }
+
public void updateCurrentInteractionMode(boolean notify) {
mCurrentUserContext = getCurrentUserContext();
int mode = getCurrentInteractionMode(mCurrentUserContext);
@@ -245,6 +334,10 @@ public class NavigationModeController implements Dumpable {
}
}
+ private boolean supportsDeviceAdmin() {
+ return mContext.getPackageManager().hasSystemFeature(FEATURE_DEVICE_ADMIN);
+ }
+
private void deferGesturalNavOverlayIfNecessary() {
final int userId = mDeviceProvisionedController.getCurrentUser();
mRestoreGesturalNavBarMode.put(userId, false);
@@ -255,6 +348,7 @@ public class NavigationModeController implements Dumpable {
Log.d(TAG, "deferGesturalNavOverlayIfNecessary: device is provisioned and user is "
+ "setup");
}
+ removeEnableGestureNavListener();
return;
}
@@ -270,6 +364,7 @@ public class NavigationModeController implements Dumpable {
Log.d(TAG, "deferGesturalNavOverlayIfNecessary: no default gestural overlay, "
+ "default=" + defaultOverlays);
}
+ removeEnableGestureNavListener();
return;
}
@@ -277,6 +372,24 @@ public class NavigationModeController implements Dumpable {
// provisioned
setModeOverlay(NAV_BAR_MODE_3BUTTON_OVERLAY, USER_CURRENT);
mRestoreGesturalNavBarMode.put(userId, true);
+
+ if (supportsDeviceAdmin() && mEnableGestureNavReceiver == null) {
+ mEnableGestureNavReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (DEBUG) {
+ Log.d(TAG, "ACTION_ENABLE_GESTURE_NAV");
+ }
+ setResultCode(enableGestureNav(intent) ? RESULT_OK : RESULT_CANCELED);
+ }
+ };
+ // Register for all users so that we can get managed users as well
+ mContext.registerReceiverAsUser(mEnableGestureNavReceiver, UserHandle.ALL,
+ new IntentFilter(ACTION_ENABLE_GESTURE_NAV), null, null);
+ if (DEBUG) {
+ Log.d(TAG, "mEnableGestureNavReceiver registered");
+ }
+ }
if (DEBUG) {
Log.d(TAG, "deferGesturalNavOverlayIfNecessary: setting to 3 button mode");
}
@@ -290,7 +403,15 @@ public class NavigationModeController implements Dumpable {
final int userId = mDeviceProvisionedController.getCurrentUser();
if (mRestoreGesturalNavBarMode.get(userId)) {
// Restore the gestural state if necessary
- setModeOverlay(NAV_BAR_MODE_GESTURAL_OVERLAY, USER_CURRENT);
+ if (!supportsDeviceAdmin()
+ || mCurrentUserContext.getSystemService(DevicePolicyManager.class)
+ .getUserProvisioningState() == STATE_USER_UNMANAGED) {
+ setGestureModeOverlayForMainLauncher();
+ } else {
+ if (DEBUG) {
+ Log.d(TAG, "Not restoring to gesture nav for managed user");
+ }
+ }
mRestoreGesturalNavBarMode.put(userId, false);
}
}
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 aebf1c8e2169..40ebe583b021 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -2386,6 +2386,10 @@ public class StatusBar extends SystemUI implements DemoMode,
mLightBarController.dump(fd, pw, args);
}
+ if (mKeyguardBypassController != null) {
+ mKeyguardBypassController.dump(pw);
+ }
+
if (mKeyguardUpdateMonitor != null) {
mKeyguardUpdateMonitor.dump(fd, pw, args);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
index d67818273ef2..65be7089ff08 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -720,7 +720,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
* animation didn't finish yet.
*/
public boolean bouncerIsOrWillBeShowing() {
- return mBouncer.isShowing() || mBouncer.willShowSoon();
+ return mBouncer.isShowing() || mBouncer.inTransit();
}
public boolean isFullscreenBouncer() {
diff --git a/services/backup/java/com/android/server/backup/FullBackupJob.java b/services/backup/java/com/android/server/backup/FullBackupJob.java
index f62a87517973..088e1f9a0db8 100644
--- a/services/backup/java/com/android/server/backup/FullBackupJob.java
+++ b/services/backup/java/com/android/server/backup/FullBackupJob.java
@@ -16,6 +16,8 @@
package com.android.server.backup;
+import static com.android.server.pm.PackageManagerService.PLATFORM_PACKAGE_NAME;
+
import android.app.job.JobInfo;
import android.app.job.JobParameters;
import android.app.job.JobScheduler;
@@ -37,7 +39,7 @@ public class FullBackupJob extends JobService {
public static final int MAX_JOB_ID = 52419896;
private static ComponentName sIdleService =
- new ComponentName("android", FullBackupJob.class.getName());
+ new ComponentName(PLATFORM_PACKAGE_NAME, FullBackupJob.class.getName());
@GuardedBy("mParamsForUser")
private final SparseArray<JobParameters> mParamsForUser = new SparseArray<>();
diff --git a/services/backup/java/com/android/server/backup/KeyValueBackupJob.java b/services/backup/java/com/android/server/backup/KeyValueBackupJob.java
index 72d81d336e91..ac43fc3b7781 100644
--- a/services/backup/java/com/android/server/backup/KeyValueBackupJob.java
+++ b/services/backup/java/com/android/server/backup/KeyValueBackupJob.java
@@ -17,6 +17,7 @@
package com.android.server.backup;
import static com.android.server.backup.BackupManagerService.DEBUG_SCHEDULING;
+import static com.android.server.pm.PackageManagerService.PLATFORM_PACKAGE_NAME;
import android.app.AlarmManager;
import android.app.job.JobInfo;
@@ -43,7 +44,7 @@ import java.util.Random;
public class KeyValueBackupJob extends JobService {
private static final String TAG = "KeyValueBackupJob";
private static ComponentName sKeyValueJobService =
- new ComponentName("android", KeyValueBackupJob.class.getName());
+ new ComponentName(PLATFORM_PACKAGE_NAME, KeyValueBackupJob.class.getName());
private static final String USER_ID_EXTRA_KEY = "userId";
diff --git a/services/backup/java/com/android/server/backup/restore/PerformUnifiedRestoreTask.java b/services/backup/java/com/android/server/backup/restore/PerformUnifiedRestoreTask.java
index a45f0c0ae186..675a6ebaedfe 100644
--- a/services/backup/java/com/android/server/backup/restore/PerformUnifiedRestoreTask.java
+++ b/services/backup/java/com/android/server/backup/restore/PerformUnifiedRestoreTask.java
@@ -26,6 +26,7 @@ import static com.android.server.backup.UserBackupManagerService.SETTINGS_PACKAG
import static com.android.server.backup.internal.BackupHandler.MSG_BACKUP_RESTORE_STEP;
import static com.android.server.backup.internal.BackupHandler.MSG_RESTORE_OPERATION_TIMEOUT;
import static com.android.server.backup.internal.BackupHandler.MSG_RESTORE_SESSION_TIMEOUT;
+import static com.android.server.pm.PackageManagerService.PLATFORM_PACKAGE_NAME;
import android.annotation.Nullable;
import android.app.ApplicationThreadConstants;
@@ -222,7 +223,7 @@ public class PerformUnifiedRestoreTask implements BackupRestoreTask {
try {
PackageManager pm = backupManagerService.getPackageManager();
PackageInfo info = pm.getPackageInfoAsUser(filterSet[i], 0, mUserId);
- if ("android".equals(info.packageName)) {
+ if (PLATFORM_PACKAGE_NAME.equals(info.packageName)) {
hasSystem = true;
continue;
}
@@ -241,7 +242,7 @@ public class PerformUnifiedRestoreTask implements BackupRestoreTask {
if (hasSystem) {
try {
mAcceptSet.add(0, backupManagerService.getPackageManager().getPackageInfoAsUser(
- "android", 0, mUserId));
+ PLATFORM_PACKAGE_NAME, 0, mUserId));
} catch (NameNotFoundException e) {
// won't happen; we know a priori that it's valid
}
@@ -681,7 +682,7 @@ public class PerformUnifiedRestoreTask implements BackupRestoreTask {
// an optimization: we know there's no widget data hosted/published by that
// package, and this way we avoid doing a spurious copy of MB-sized wallpaper
// data following the download.
- boolean staging = !packageName.equals("android");
+ boolean staging = !packageName.equals(PLATFORM_PACKAGE_NAME);
ParcelFileDescriptor stage;
File downloadFile = (staging) ? mStageName : mBackupDataName;
boolean startedAgentRestore = false;
diff --git a/services/core/java/com/android/server/LocationManagerService.java b/services/core/java/com/android/server/LocationManagerService.java
index b36bbaa252c2..930cf9efdb1a 100644
--- a/services/core/java/com/android/server/LocationManagerService.java
+++ b/services/core/java/com/android/server/LocationManagerService.java
@@ -467,7 +467,7 @@ public class LocationManagerService extends ILocationManager.Stub {
// the user being changed will cause a reload of all user specific settings, which causes
// provider initialization, and propagates changes until a steady state is reached
mCurrentUserId = UserHandle.USER_NULL;
- onUserChangedLocked(UserHandle.USER_SYSTEM);
+ onUserChangedLocked(ActivityManager.getCurrentUser());
// initialize in-memory settings values
onBackgroundThrottleWhitelistChangedLocked();
diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java
index d8487968f425..4f54e64f6911 100644
--- a/services/core/java/com/android/server/accounts/AccountManagerService.java
+++ b/services/core/java/com/android/server/accounts/AccountManagerService.java
@@ -1440,6 +1440,11 @@ public class AccountManagerService
@Override
public void onServiceChanged(AuthenticatorDescription desc, int userId, boolean removed) {
+ UserInfo user = getUserManager().getUserInfo(userId);
+ if (user == null) {
+ Log.w(TAG, "onServiceChanged: ignore removed user " + userId);
+ return;
+ }
validateAccountsInternal(getUserAccounts(userId), false /* invalidateAuthenticatorCache */);
}
diff --git a/services/core/java/com/android/server/am/OomAdjProfiler.java b/services/core/java/com/android/server/am/OomAdjProfiler.java
index 9846b310c917..7e38184040d9 100644
--- a/services/core/java/com/android/server/am/OomAdjProfiler.java
+++ b/services/core/java/com/android/server/am/OomAdjProfiler.java
@@ -16,6 +16,7 @@
package com.android.server.am;
+import android.os.Message;
import android.os.PowerManagerInternal;
import android.os.Process;
import android.os.SystemClock;
@@ -29,14 +30,20 @@ import com.android.internal.util.function.pooled.PooledLambda;
import java.io.PrintWriter;
public class OomAdjProfiler {
- // Disable profiling for Q. Re-enable once b/130635979 is fixed.
- private static final boolean PROFILING_DISABLED = true;
+ private static final int MSG_UPDATE_CPU_TIME = 42;
@GuardedBy("this")
private boolean mOnBattery;
@GuardedBy("this")
private boolean mScreenOff;
+ /** The value of {@link #mOnBattery} when the CPU time update was last scheduled. */
+ @GuardedBy("this")
+ private boolean mLastScheduledOnBattery;
+ /** The value of {@link #mScreenOff} when the CPU time update was last scheduled. */
+ @GuardedBy("this")
+ private boolean mLastScheduledScreenOff;
+
@GuardedBy("this")
private long mOomAdjStartTimeMs;
@GuardedBy("this")
@@ -59,9 +66,6 @@ public class OomAdjProfiler {
final RingBuffer<CpuTimes> mSystemServerCpuTimesHist = new RingBuffer<>(CpuTimes.class, 10);
void batteryPowerChanged(boolean onBattery) {
- if (PROFILING_DISABLED) {
- return;
- }
synchronized (this) {
scheduleSystemServerCpuTimeUpdate();
mOnBattery = onBattery;
@@ -69,9 +73,6 @@ public class OomAdjProfiler {
}
void onWakefulnessChanged(int wakefulness) {
- if (PROFILING_DISABLED) {
- return;
- }
synchronized (this) {
scheduleSystemServerCpuTimeUpdate();
mScreenOff = wakefulness != PowerManagerInternal.WAKEFULNESS_AWAKE;
@@ -79,9 +80,6 @@ public class OomAdjProfiler {
}
void oomAdjStarted() {
- if (PROFILING_DISABLED) {
- return;
- }
synchronized (this) {
mOomAdjStartTimeMs = SystemClock.currentThreadTimeMillis();
mOomAdjStarted = true;
@@ -89,9 +87,6 @@ public class OomAdjProfiler {
}
void oomAdjEnded() {
- if (PROFILING_DISABLED) {
- return;
- }
synchronized (this) {
if (!mOomAdjStarted) {
return;
@@ -101,31 +96,33 @@ public class OomAdjProfiler {
}
private void scheduleSystemServerCpuTimeUpdate() {
- if (PROFILING_DISABLED) {
- return;
- }
synchronized (this) {
if (mSystemServerCpuTimeUpdateScheduled) {
return;
}
+ mLastScheduledOnBattery = mOnBattery;
+ mLastScheduledScreenOff = mScreenOff;
mSystemServerCpuTimeUpdateScheduled = true;
- BackgroundThread.getHandler().sendMessage(PooledLambda.obtainMessage(
+ Message scheduledMessage = PooledLambda.obtainMessage(
OomAdjProfiler::updateSystemServerCpuTime,
- this, mOnBattery, mScreenOff));
+ this, mLastScheduledOnBattery, mLastScheduledScreenOff, true);
+ scheduledMessage.setWhat(MSG_UPDATE_CPU_TIME);
+
+ BackgroundThread.getHandler().sendMessage(scheduledMessage);
}
}
- private void updateSystemServerCpuTime(boolean onBattery, boolean screenOff) {
- if (PROFILING_DISABLED) {
- return;
- }
+ private void updateSystemServerCpuTime(boolean onBattery, boolean screenOff,
+ boolean onlyIfScheduled) {
final long cpuTimeMs = mProcessCpuTracker.getCpuTimeForPid(Process.myPid());
synchronized (this) {
+ if (onlyIfScheduled && !mSystemServerCpuTimeUpdateScheduled) {
+ return;
+ }
mSystemServerCpuTime.addCpuTimeMs(
cpuTimeMs - mLastSystemServerCpuTimeMs, onBattery, screenOff);
mLastSystemServerCpuTimeMs = cpuTimeMs;
mSystemServerCpuTimeUpdateScheduled = false;
- notifyAll();
}
}
@@ -142,20 +139,14 @@ public class OomAdjProfiler {
}
void dump(PrintWriter pw) {
- if (PROFILING_DISABLED) {
- return;
- }
synchronized (this) {
if (mSystemServerCpuTimeUpdateScheduled) {
- while (mSystemServerCpuTimeUpdateScheduled) {
- try {
- wait();
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- }
- }
+ // Cancel the scheduled update since we're going to update it here instead.
+ BackgroundThread.getHandler().removeMessages(MSG_UPDATE_CPU_TIME);
+ // Make sure the values are attributed to the right states.
+ updateSystemServerCpuTime(mLastScheduledOnBattery, mLastScheduledScreenOff, false);
} else {
- updateSystemServerCpuTime(mOnBattery, mScreenOff);
+ updateSystemServerCpuTime(mOnBattery, mScreenOff, false);
}
pw.println("System server and oomAdj runtimes (ms) in recent battery sessions "
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 6c57be8bbadf..7458bee793db 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -5181,6 +5181,7 @@ public class AudioService extends IAudioService.Stub
/**
* @return true if there is currently a registered dynamic mixing policy that affects media
+ * and is not a render + loopback policy
*/
/*package*/ boolean hasMediaDynamicPolicy() {
synchronized (mAudioPolicies) {
@@ -5189,7 +5190,8 @@ public class AudioService extends IAudioService.Stub
}
final Collection<AudioPolicyProxy> appColl = mAudioPolicies.values();
for (AudioPolicyProxy app : appColl) {
- if (app.hasMixAffectingUsage(AudioAttributes.USAGE_MEDIA)) {
+ if (app.hasMixAffectingUsage(AudioAttributes.USAGE_MEDIA,
+ AudioMix.ROUTE_FLAG_LOOP_BACK_RENDER)) {
return true;
}
}
@@ -6961,9 +6963,10 @@ public class AudioService extends IAudioService.Stub
Binder.restoreCallingIdentity(identity);
}
- boolean hasMixAffectingUsage(int usage) {
+ boolean hasMixAffectingUsage(int usage, int excludedFlags) {
for (AudioMix mix : mMixes) {
- if (mix.isAffectingUsage(usage)) {
+ if (mix.isAffectingUsage(usage)
+ && ((mix.getRouteFlags() & excludedFlags) != excludedFlags)) {
return true;
}
}
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
index 6c34e1313f73..d3346cddf3d0 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -232,7 +232,6 @@ import com.android.server.ServiceThread;
import com.android.server.SystemConfig;
import libcore.io.IoUtils;
-import libcore.util.EmptyArray;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlSerializer;
@@ -540,7 +539,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
private final SparseArray<String> mSubIdToSubscriberId = new SparseArray<>();
/** Set of all merged subscriberId as of last update */
@GuardedBy("mNetworkPoliciesSecondLock")
- private String[] mMergedSubscriberIds = EmptyArray.STRING;
+ private List<String[]> mMergedSubscriberIds = new ArrayList<>();
/**
* Indicates the uids restricted by admin from accessing metered data. It's a mapping from
@@ -1801,7 +1800,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
final SubscriptionManager sm = mContext.getSystemService(SubscriptionManager.class);
final int[] subIds = ArrayUtils.defeatNullable(sm.getActiveSubscriptionIdList());
- final String[] mergedSubscriberIds = ArrayUtils.defeatNullable(tm.getMergedSubscriberIds());
+ final List<String[]> mergedSubscriberIdsList = new ArrayList();
final SparseArray<String> subIdToSubscriberId = new SparseArray<>(subIds.length);
for (int subId : subIds) {
@@ -1811,6 +1810,10 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
} else {
Slog.wtf(TAG, "Missing subscriberId for subId " + subId);
}
+
+ String[] mergedSubscriberId = ArrayUtils.defeatNullable(
+ tm.createForSubscriptionId(subId).getMergedSubscriberIdsFromGroup());
+ mergedSubscriberIdsList.add(mergedSubscriberId);
}
synchronized (mNetworkPoliciesSecondLock) {
@@ -1820,7 +1823,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
subIdToSubscriberId.valueAt(i));
}
- mMergedSubscriberIds = mergedSubscriberIds;
+ mMergedSubscriberIds = mergedSubscriberIdsList;
}
Trace.traceEnd(TRACE_TAG_NETWORK);
@@ -3373,8 +3376,10 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
fout.decreaseIndent();
fout.println();
- fout.println("Merged subscriptions: "
- + Arrays.toString(NetworkIdentity.scrubSubscriberId(mMergedSubscriberIds)));
+ for (String[] mergedSubscribers : mMergedSubscriberIds) {
+ fout.println("Merged subscriptions: " + Arrays.toString(
+ NetworkIdentity.scrubSubscriberId(mergedSubscribers)));
+ }
fout.println();
fout.println("Policy for UIDs:");
diff --git a/services/core/java/com/android/server/pm/StagingManager.java b/services/core/java/com/android/server/pm/StagingManager.java
index 42b65c357959..bf141a0f139b 100644
--- a/services/core/java/com/android/server/pm/StagingManager.java
+++ b/services/core/java/com/android/server/pm/StagingManager.java
@@ -242,11 +242,11 @@ public class StagingManager {
}
if (sessionContainsApk(session)) {
- if (!installApksInSession(session, /* preReboot */ true)) {
- session.setStagedSessionFailed(SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
- "APK verification failed. Check logcat messages for "
- + "more information.");
+ try {
+ installApksInSession(session, /* preReboot */ true);
// TODO(b/118865310): abort the session on apexd.
+ } catch (PackageManagerException e) {
+ session.setStagedSessionFailed(e.error, e.getMessage());
return;
}
}
@@ -315,7 +315,7 @@ public class StagingManager {
}
private void resumeSession(@NonNull PackageInstallerSession session) {
- boolean hasApex = sessionContainsApex(session);
+ final boolean hasApex = sessionContainsApex(session);
if (hasApex) {
// Check with apexservice whether the apex packages have been activated.
ApexSessionInfo apexSessionInfo = mApexManager.getStagedSessionInfo(session.sessionId);
@@ -350,10 +350,10 @@ public class StagingManager {
}
}
// The APEX part of the session is activated, proceed with the installation of APKs.
- if (!installApksInSession(session, /* preReboot */ false)) {
- session.setStagedSessionFailed(SessionInfo.STAGED_SESSION_ACTIVATION_FAILED,
- "Staged installation of APKs failed. Check logcat messages for"
- + "more information.");
+ try {
+ installApksInSession(session, /* preReboot */ false);
+ } catch (PackageManagerException e) {
+ session.setStagedSessionFailed(e.error, e.getMessage());
if (!hasApex) {
return;
@@ -388,16 +388,22 @@ public class StagingManager {
return ret;
}
+ @NonNull
private PackageInstallerSession createAndWriteApkSession(
- @NonNull PackageInstallerSession originalSession, boolean preReboot) {
+ @NonNull PackageInstallerSession originalSession, boolean preReboot)
+ throws PackageManagerException {
+ final int errorCode = preReboot ? SessionInfo.STAGED_SESSION_VERIFICATION_FAILED
+ : SessionInfo.STAGED_SESSION_ACTIVATION_FAILED;
if (originalSession.stageDir == null) {
Slog.wtf(TAG, "Attempting to install a staged APK session with no staging dir");
- return null;
+ throw new PackageManagerException(errorCode,
+ "Attempting to install a staged APK session with no staging dir");
}
List<String> apkFilePaths = findAPKsInDir(originalSession.stageDir);
if (apkFilePaths.isEmpty()) {
Slog.w(TAG, "Can't find staged APK in " + originalSession.stageDir.getAbsolutePath());
- return null;
+ throw new PackageManagerException(errorCode,
+ "Can't find staged APK in " + originalSession.stageDir.getAbsolutePath());
}
PackageInstaller.SessionParams params = originalSession.params.copy();
@@ -424,20 +430,22 @@ public class StagingManager {
long sizeBytes = pfd.getStatSize();
if (sizeBytes < 0) {
Slog.e(TAG, "Unable to get size of: " + apkFilePath);
- return null;
+ throw new PackageManagerException(errorCode,
+ "Unable to get size of: " + apkFilePath);
}
apkSession.write(apkFile.getName(), 0, sizeBytes, pfd);
}
} catch (IOException e) {
Slog.e(TAG, "Failure to install APK staged session " + originalSession.sessionId, e);
- return null;
+ throw new PackageManagerException(errorCode, "Failed to write APK session", e);
}
return apkSession;
}
- private boolean commitApkSession(@NonNull PackageInstallerSession apkSession,
- int originalSessionId, boolean preReboot) {
-
+ private void commitApkSession(@NonNull PackageInstallerSession apkSession,
+ int originalSessionId, boolean preReboot) throws PackageManagerException {
+ final int errorCode = preReboot ? SessionInfo.STAGED_SESSION_VERIFICATION_FAILED
+ : SessionInfo.STAGED_SESSION_ACTIVATION_FAILED;
if (!preReboot) {
if ((apkSession.params.installFlags & PackageManager.INSTALL_ENABLE_ROLLBACK) != 0) {
// If rollback is available for this session, notify the rollback
@@ -457,23 +465,24 @@ public class StagingManager {
final Intent result = receiver.getResult();
final int status = result.getIntExtra(PackageInstaller.EXTRA_STATUS,
PackageInstaller.STATUS_FAILURE);
- if (status == PackageInstaller.STATUS_SUCCESS) {
- return true;
+ if (status != PackageInstaller.STATUS_SUCCESS) {
+
+ final String errorMessage = result.getStringExtra(
+ PackageInstaller.EXTRA_STATUS_MESSAGE);
+ Slog.e(TAG, "Failure to install APK staged session " + originalSessionId + " ["
+ + errorMessage + "]");
+ throw new PackageManagerException(errorCode, errorMessage);
}
- Slog.e(TAG, "Failure to install APK staged session " + originalSessionId + " ["
- + result.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE) + "]");
- return false;
}
- private boolean installApksInSession(@NonNull PackageInstallerSession session,
- boolean preReboot) {
+ private void installApksInSession(@NonNull PackageInstallerSession session,
+ boolean preReboot) throws PackageManagerException {
+ final int errorCode = preReboot ? SessionInfo.STAGED_SESSION_VERIFICATION_FAILED
+ : SessionInfo.STAGED_SESSION_ACTIVATION_FAILED;
if (!session.isMultiPackage() && !isApexSession(session)) {
// APK single-packaged staged session. Do a regular install.
PackageInstallerSession apkSession = createAndWriteApkSession(session, preReboot);
- if (apkSession == null) {
- return false;
- }
- return commitApkSession(apkSession, session.sessionId, preReboot);
+ commitApkSession(apkSession, session.sessionId, preReboot);
} else if (session.isMultiPackage()) {
// For multi-package staged sessions containing APKs, we identify which child sessions
// contain an APK, and with those then create a new multi-package group of sessions,
@@ -491,7 +500,7 @@ public class StagingManager {
}
if (childSessions.isEmpty()) {
// APEX-only multi-package staged session, nothing to do.
- return true;
+ return;
}
PackageInstaller.SessionParams params = session.params.copy();
params.isStaged = false;
@@ -508,26 +517,24 @@ public class StagingManager {
} catch (IOException e) {
Slog.e(TAG, "Unable to prepare multi-package session for staged session "
+ session.sessionId);
- return false;
+ throw new PackageManagerException(errorCode,
+ "Unable to prepare multi-package session for staged session");
}
for (PackageInstallerSession sessionToClone : childSessions) {
PackageInstallerSession apkChildSession =
createAndWriteApkSession(sessionToClone, preReboot);
- if (apkChildSession == null) {
- return false;
- }
try {
apkParentSession.addChildSessionId(apkChildSession.sessionId);
} catch (IllegalStateException e) {
Slog.e(TAG, "Failed to add a child session for installing the APK files", e);
- return false;
+ throw new PackageManagerException(errorCode,
+ "Failed to add a child session " + apkChildSession.sessionId);
}
}
- return commitApkSession(apkParentSession, session.sessionId, preReboot);
+ commitApkSession(apkParentSession, session.sessionId, preReboot);
}
// APEX single-package staged session, nothing to do.
- return true;
}
void commitSession(@NonNull PackageInstallerSession session) {
diff --git a/services/core/java/com/android/server/policy/PermissionPolicyService.java b/services/core/java/com/android/server/policy/PermissionPolicyService.java
index 037293f9536c..a569bffef141 100644
--- a/services/core/java/com/android/server/policy/PermissionPolicyService.java
+++ b/services/core/java/com/android/server/policy/PermissionPolicyService.java
@@ -798,7 +798,7 @@ public final class PermissionPolicyService extends SystemService {
@Override
public boolean checkStartActivity(@NonNull Intent intent, int callingUid,
@Nullable String callingPackage) {
- if (callingPackage != null && isActionRemovedForCallingPackage(intent.getAction(),
+ if (callingPackage != null && isActionRemovedForCallingPackage(intent, callingUid,
callingPackage)) {
Slog.w(LOG_TAG, "Action Removed: starting " + intent.toString() + " from "
+ callingPackage + " (uid=" + callingUid + ")");
@@ -811,8 +811,9 @@ public final class PermissionPolicyService extends SystemService {
* Check if the intent action is removed for the calling package (often based on target SDK
* version). If the action is removed, we'll silently cancel the activity launch.
*/
- private boolean isActionRemovedForCallingPackage(@Nullable String action,
+ private boolean isActionRemovedForCallingPackage(@NonNull Intent intent, int callingUid,
@NonNull String callingPackage) {
+ String action = intent.getAction();
if (action == null) {
return false;
}
@@ -821,15 +822,19 @@ public final class PermissionPolicyService extends SystemService {
case Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT: {
ApplicationInfo applicationInfo;
try {
- applicationInfo = getContext().getPackageManager().getApplicationInfo(
- callingPackage, 0);
+ applicationInfo = getContext().getPackageManager().getApplicationInfoAsUser(
+ callingPackage, 0, UserHandle.getUserId(callingUid));
+ if (applicationInfo.targetSdkVersion >= Build.VERSION_CODES.Q) {
+ // Applications targeting Q or higher should use
+ // RoleManager.createRequestRoleIntent() instead.
+ return true;
+ }
} catch (PackageManager.NameNotFoundException e) {
Slog.i(LOG_TAG, "Cannot find application info for " + callingPackage);
- return false;
}
- // Applications targeting Q should use RoleManager.createRequestRoleIntent()
- // instead.
- return applicationInfo.targetSdkVersion >= Build.VERSION_CODES.Q;
+ // Make sure RequestRoleActivity can know the calling package if we allow it.
+ intent.putExtra(Intent.EXTRA_CALLING_PACKAGE, callingPackage);
+ return false;
}
default:
return false;
diff --git a/services/core/java/com/android/server/role/RoleManagerService.java b/services/core/java/com/android/server/role/RoleManagerService.java
index c6a1867fa1e9..b503ce87bae2 100644
--- a/services/core/java/com/android/server/role/RoleManagerService.java
+++ b/services/core/java/com/android/server/role/RoleManagerService.java
@@ -17,6 +17,7 @@
package com.android.server.role;
import android.Manifest;
+import android.annotation.AnyThread;
import android.annotation.CheckResult;
import android.annotation.MainThread;
import android.annotation.NonNull;
@@ -49,7 +50,6 @@ import android.os.ResultReceiver;
import android.os.ShellCallback;
import android.os.UserHandle;
import android.os.UserManagerInternal;
-import android.provider.Telephony;
import android.service.sms.FinancialSmsService;
import android.telephony.IFinancialSmsCallback;
import android.text.TextUtils;
@@ -61,6 +61,8 @@ import android.util.SparseArray;
import android.util.proto.ProtoOutputStream;
import com.android.internal.annotations.GuardedBy;
+import com.android.internal.infra.AndroidFuture;
+import com.android.internal.infra.ThrottledRunnable;
import com.android.internal.telephony.SmsApplication;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.BitUtils;
@@ -82,7 +84,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
-import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@@ -99,6 +100,8 @@ public class RoleManagerService extends SystemService implements RoleUserState.C
private static final boolean DEBUG = false;
+ private static final long GRANT_DEFAULT_ROLES_INTERVAL_MILLIS = 1000;
+
@NonNull
private final UserManagerInternal mUserManagerInternal;
@NonNull
@@ -142,6 +145,14 @@ public class RoleManagerService extends SystemService implements RoleUserState.C
@NonNull
private final Handler mListenerHandler = FgThread.getHandler();
+ /**
+ * Maps user id to its throttled runnable for granting default roles.
+ */
+ @GuardedBy("mLock")
+ @NonNull
+ private final SparseArray<ThrottledRunnable> mGrantDefaultRolesThrottledRunnables =
+ new SparseArray<>();
+
public RoleManagerService(@NonNull Context context,
@NonNull RoleHoldersResolver legacyRoleResolver) {
super(context);
@@ -182,8 +193,6 @@ public class RoleManagerService extends SystemService implements RoleUserState.C
public void onStart() {
publishBinderService(Context.ROLE_SERVICE, new Stub());
- //TODO add watch for new user creation and run default grants for them
-
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Intent.ACTION_PACKAGE_CHANGED);
intentFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
@@ -203,64 +212,78 @@ public class RoleManagerService extends SystemService implements RoleUserState.C
// Package is being upgraded - we're about to get ACTION_PACKAGE_ADDED
return;
}
- performInitialGrantsIfNecessaryAsync(userId);
+ maybeGrantDefaultRolesAsync(userId);
}
}, UserHandle.ALL, intentFilter, null, null);
}
@Override
public void onStartUser(@UserIdInt int userId) {
- performInitialGrantsIfNecessary(userId);
- }
-
- private CompletableFuture<Void> performInitialGrantsIfNecessaryAsync(@UserIdInt int userId) {
- RoleUserState userState;
- userState = getOrCreateUserState(userId);
-
- String packagesHash = computeComponentStateHash(userId);
- String oldPackagesHash = userState.getPackagesHash();
- boolean needGrant = !Objects.equals(packagesHash, oldPackagesHash);
- if (needGrant) {
-
- //TODO gradually add more role migrations statements here for remaining roles
- // Make sure to implement LegacyRoleResolutionPolicy#getRoleHolders
- // for a given role before adding a migration statement for it here
- migrateRoleIfNecessary(RoleManager.ROLE_SMS, userId);
- migrateRoleIfNecessary(RoleManager.ROLE_ASSISTANT, userId);
- migrateRoleIfNecessary(RoleManager.ROLE_DIALER, userId);
- migrateRoleIfNecessary(RoleManager.ROLE_EMERGENCY, userId);
-
- // Some vital packages state has changed since last role grant
- // Run grants again
- Slog.i(LOG_TAG, "Granting default permissions...");
- CompletableFuture<Void> result = new CompletableFuture<>();
- getOrCreateController(userId).grantDefaultRoles(FgThread.getExecutor(),
- successful -> {
- if (successful) {
- userState.setPackagesHash(packagesHash);
- result.complete(null);
- } else {
- result.completeExceptionally(new RuntimeException());
- }
- });
- return result;
- } else if (DEBUG) {
- Slog.i(LOG_TAG, "Already ran grants for package state " + packagesHash);
- }
- return CompletableFuture.completedFuture(null);
+ maybeGrantDefaultRolesSync(userId);
}
@MainThread
- private void performInitialGrantsIfNecessary(@UserIdInt int userId) {
- CompletableFuture<Void> result = performInitialGrantsIfNecessaryAsync(userId);
+ private void maybeGrantDefaultRolesSync(@UserIdInt int userId) {
+ AndroidFuture<Void> future = maybeGrantDefaultRolesInternal(userId);
try {
- result.get(30, TimeUnit.SECONDS);
+ future.get(30, TimeUnit.SECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
- Slog.e(LOG_TAG, "Failed to grant defaults for user " + userId, e);
+ Slog.e(LOG_TAG, "Failed to grant default roles for user " + userId, e);
}
}
- private void migrateRoleIfNecessary(String role, @UserIdInt int userId) {
+ private void maybeGrantDefaultRolesAsync(@UserIdInt int userId) {
+ ThrottledRunnable runnable;
+ synchronized (mLock) {
+ runnable = mGrantDefaultRolesThrottledRunnables.get(userId);
+ if (runnable == null) {
+ runnable = new ThrottledRunnable(FgThread.getHandler(),
+ GRANT_DEFAULT_ROLES_INTERVAL_MILLIS,
+ () -> maybeGrantDefaultRolesInternal(userId));
+ mGrantDefaultRolesThrottledRunnables.put(userId, runnable);
+ }
+ }
+ runnable.run();
+ }
+
+ @AnyThread
+ @NonNull
+ private AndroidFuture<Void> maybeGrantDefaultRolesInternal(@UserIdInt int userId) {
+ RoleUserState userState = getOrCreateUserState(userId);
+ String oldPackagesHash = userState.getPackagesHash();
+ String newPackagesHash = computeComponentStateHash(userId);
+ if (Objects.equals(oldPackagesHash, newPackagesHash)) {
+ if (DEBUG) {
+ Slog.i(LOG_TAG, "Already granted default roles for packages hash "
+ + newPackagesHash);
+ }
+ return AndroidFuture.completedFuture(null);
+ }
+
+ //TODO gradually add more role migrations statements here for remaining roles
+ // Make sure to implement LegacyRoleResolutionPolicy#getRoleHolders
+ // for a given role before adding a migration statement for it here
+ maybeMigrateRole(RoleManager.ROLE_SMS, userId);
+ maybeMigrateRole(RoleManager.ROLE_ASSISTANT, userId);
+ maybeMigrateRole(RoleManager.ROLE_DIALER, userId);
+ maybeMigrateRole(RoleManager.ROLE_EMERGENCY, userId);
+
+ // Some package state has changed, so grant default roles again.
+ Slog.i(LOG_TAG, "Granting default roles...");
+ AndroidFuture<Void> future = new AndroidFuture<>();
+ getOrCreateController(userId).grantDefaultRoles(FgThread.getExecutor(),
+ successful -> {
+ if (successful) {
+ userState.setPackagesHash(newPackagesHash);
+ future.complete(null);
+ } else {
+ future.completeExceptionally(new RuntimeException());
+ }
+ });
+ return future;
+ }
+
+ private void maybeMigrateRole(String role, @UserIdInt int userId) {
// Any role for which we have a record are already migrated
RoleUserState userState = getOrCreateUserState(userId);
if (!userState.isRoleAvailable(role)) {
@@ -366,6 +389,7 @@ public class RoleManagerService extends SystemService implements RoleUserState.C
RemoteCallbackList<IOnRoleHoldersChangedListener> listeners;
RoleUserState userState;
synchronized (mLock) {
+ mGrantDefaultRolesThrottledRunnables.remove(userId);
listeners = mListeners.removeReturnOld(userId);
mControllers.remove(userId);
userState = mUserStates.removeReturnOld(userId);
@@ -742,7 +766,7 @@ public class RoleManagerService extends SystemService implements RoleUserState.C
@Override
public boolean setDefaultBrowser(@Nullable String packageName, @UserIdInt int userId) {
- CompletableFuture<Void> future = new CompletableFuture<>();
+ AndroidFuture<Void> future = new AndroidFuture<>();
RemoteCallback callback = new RemoteCallback(result -> {
boolean successful = result != null;
if (successful) {
diff --git a/services/usage/java/com/android/server/usage/UsageStatsProto.java b/services/usage/java/com/android/server/usage/UsageStatsProto.java
index 63bf7e7629a9..3e88d93cc303 100644
--- a/services/usage/java/com/android/server/usage/UsageStatsProto.java
+++ b/services/usage/java/com/android/server/usage/UsageStatsProto.java
@@ -44,7 +44,7 @@ final class UsageStatsProto {
final long token = proto.start(IntervalStatsProto.STRINGPOOL);
List<String> stringPool;
- if (proto.isNextField(IntervalStatsProto.StringPool.SIZE)) {
+ if (proto.nextField(IntervalStatsProto.StringPool.SIZE)) {
stringPool = new ArrayList(proto.readInt(IntervalStatsProto.StringPool.SIZE));
} else {
stringPool = new ArrayList();
@@ -66,12 +66,12 @@ final class UsageStatsProto {
final long token = proto.start(fieldId);
UsageStats stats;
- if (proto.isNextField(IntervalStatsProto.UsageStats.PACKAGE_INDEX)) {
+ if (proto.nextField(IntervalStatsProto.UsageStats.PACKAGE_INDEX)) {
// Fast path reading the package name index. Most cases this should work since it is
// written first
stats = statsOut.getOrCreateUsageStats(
stringPool.get(proto.readInt(IntervalStatsProto.UsageStats.PACKAGE_INDEX) - 1));
- } else if (proto.isNextField(IntervalStatsProto.UsageStats.PACKAGE)) {
+ } else if (proto.nextField(IntervalStatsProto.UsageStats.PACKAGE)) {
// No package index, try package name instead
stats = statsOut.getOrCreateUsageStats(
proto.readString(IntervalStatsProto.UsageStats.PACKAGE));
@@ -177,7 +177,7 @@ final class UsageStatsProto {
}
String action = null;
ArrayMap<String, Integer> counts;
- if (proto.isNextField(IntervalStatsProto.UsageStats.ChooserAction.NAME)) {
+ if (proto.nextField(IntervalStatsProto.UsageStats.ChooserAction.NAME)) {
// Fast path reading the action name. Most cases this should work since it is written
// first
action = proto.readString(IntervalStatsProto.UsageStats.ChooserAction.NAME);
@@ -244,7 +244,7 @@ final class UsageStatsProto {
boolean configActive = false;
final Configuration config = new Configuration();
ConfigurationStats configStats;
- if (proto.isNextField(IntervalStatsProto.Configuration.CONFIG)) {
+ if (proto.nextField(IntervalStatsProto.Configuration.CONFIG)) {
// Fast path reading the configuration. Most cases this should work since it is
// written first
config.readFromProto(proto, IntervalStatsProto.Configuration.CONFIG);
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 484fd3b17c02..2822fccdb398 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -2116,29 +2116,36 @@ public class SubscriptionManager {
}
/**
+ * TODO(b/137102918) Make this static, tests use this as an instance method currently.
+ *
* @return the list of subId's that are active,
* is never null but the length maybe 0.
* @hide
*/
@UnsupportedAppUsage
public @NonNull int[] getActiveSubscriptionIdList() {
- int[] subId = null;
+ return getActiveSubscriptionIdList(/* visibleOnly */ true);
+ }
+ /**
+ * TODO(b/137102918) Make this static, tests use this as an instance method currently.
+ *
+ * @return a non-null list of subId's that are active.
+ *
+ * @hide
+ */
+ public @NonNull int[] getActiveSubscriptionIdList(boolean visibleOnly) {
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- subId = iSub.getActiveSubIdList(/*visibleOnly*/true);
+ int[] subId = iSub.getActiveSubIdList(visibleOnly);
+ if (subId != null) return subId;
}
} catch (RemoteException ex) {
// ignore it
}
- if (subId == null) {
- subId = new int[0];
- }
-
- return subId;
-
+ return new int[0];
}
/**
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 6cfec3c5fce3..fd475619ca15 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -3983,9 +3983,14 @@ public class TelephonyManager {
* The returned set of subscriber IDs will include the subscriber ID corresponding to this
* TelephonyManager's subId.
*
+ * This is deprecated and {@link #getMergedSubscriberIdsFromGroup()} should be used for data
+ * usage merging purpose.
+ * TODO: remove this API.
+ *
* @hide
*/
@UnsupportedAppUsage
+ @Deprecated
public @Nullable String[] getMergedSubscriberIds() {
try {
ITelephony telephony = getITelephony();
@@ -3998,6 +4003,28 @@ public class TelephonyManager {
}
/**
+ * Return the set of subscriber IDs that should be considered "merged together" for data usage
+ * purposes. Unlike {@link #getMergedSubscriberIds()} this API merge subscriberIds based on
+ * subscription grouping: subscriberId of those in the same group will all be returned.
+ *
+ * <p>Requires the calling app to have READ_PRIVILEGED_PHONE_STATE permission.
+ *
+ * @hide
+ */
+ @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ public @Nullable String[] getMergedSubscriberIdsFromGroup() {
+ try {
+ ITelephony telephony = getITelephony();
+ if (telephony != null) {
+ return telephony.getMergedSubscriberIdsFromGroup(getSubId(), getOpPackageName());
+ }
+ } catch (RemoteException ex) {
+ } catch (NullPointerException ex) {
+ }
+ return null;
+ }
+
+ /**
* Returns the MSISDN string.
* for a GSM phone. Return null if it is unavailable.
*
diff --git a/telephony/java/android/telephony/ims/RcsControllerCall.java b/telephony/java/android/telephony/ims/RcsControllerCall.java
index a2d68ad0cdb0..ce03c3c799bb 100644
--- a/telephony/java/android/telephony/ims/RcsControllerCall.java
+++ b/telephony/java/android/telephony/ims/RcsControllerCall.java
@@ -19,10 +19,11 @@ package android.telephony.ims;
import android.content.Context;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.telephony.ims.aidl.IRcs;
+import android.telephony.ims.aidl.IRcsMessage;
/**
- * A wrapper class around RPC calls that {@link RcsMessageStore} APIs to minimize boilerplate code.
+ * A wrapper class around RPC calls that {@link RcsMessageManager} APIs to minimize boilerplate
+ * code.
*
* @hide - not meant for public use
*/
@@ -34,13 +35,14 @@ class RcsControllerCall {
}
<R> R call(RcsServiceCall<R> serviceCall) throws RcsMessageStoreException {
- IRcs iRcs = IRcs.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_RCS_SERVICE));
- if (iRcs == null) {
+ IRcsMessage iRcsMessage = IRcsMessage.Stub.asInterface(ServiceManager.getService(
+ Context.TELEPHONY_RCS_MESSAGE_SERVICE));
+ if (iRcsMessage == null) {
throw new RcsMessageStoreException("Could not connect to RCS storage service");
}
try {
- return serviceCall.methodOnIRcs(iRcs, mContext.getOpPackageName());
+ return serviceCall.methodOnIRcs(iRcsMessage, mContext.getOpPackageName());
} catch (RemoteException exception) {
throw new RcsMessageStoreException(exception.getMessage());
}
@@ -48,17 +50,17 @@ class RcsControllerCall {
void callWithNoReturn(RcsServiceCallWithNoReturn serviceCall)
throws RcsMessageStoreException {
- call((iRcs, callingPackage) -> {
- serviceCall.methodOnIRcs(iRcs, callingPackage);
+ call((iRcsMessage, callingPackage) -> {
+ serviceCall.methodOnIRcs(iRcsMessage, callingPackage);
return null;
});
}
interface RcsServiceCall<R> {
- R methodOnIRcs(IRcs iRcs, String callingPackage) throws RemoteException;
+ R methodOnIRcs(IRcsMessage iRcs, String callingPackage) throws RemoteException;
}
interface RcsServiceCallWithNoReturn {
- void methodOnIRcs(IRcs iRcs, String callingPackage) throws RemoteException;
+ void methodOnIRcs(IRcsMessage iRcs, String callingPackage) throws RemoteException;
}
}
diff --git a/telephony/java/android/telephony/ims/RcsManager.java b/telephony/java/android/telephony/ims/RcsManager.java
deleted file mode 100644
index 0d6ca3cc58e1..000000000000
--- a/telephony/java/android/telephony/ims/RcsManager.java
+++ /dev/null
@@ -1,43 +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 android.telephony.ims;
-
-import android.annotation.SystemService;
-import android.content.Context;
-
-/**
- * The manager class for RCS related utilities.
- *
- * @hide
- */
-@SystemService(Context.TELEPHONY_RCS_SERVICE)
-public class RcsManager {
- private final RcsMessageStore mRcsMessageStore;
-
- /**
- * @hide
- */
- public RcsManager(Context context) {
- mRcsMessageStore = new RcsMessageStore(context);
- }
-
- /**
- * Returns an instance of {@link RcsMessageStore}
- */
- public RcsMessageStore getRcsMessageStore() {
- return mRcsMessageStore;
- }
-}
diff --git a/telephony/java/android/telephony/ims/RcsMessageStore.java b/telephony/java/android/telephony/ims/RcsMessageManager.java
index d1127984f126..a1c7c0fefab2 100644
--- a/telephony/java/android/telephony/ims/RcsMessageStore.java
+++ b/telephony/java/android/telephony/ims/RcsMessageManager.java
@@ -18,6 +18,7 @@ package android.telephony.ims;
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.SystemService;
import android.annotation.WorkerThread;
import android.content.Context;
import android.net.Uri;
@@ -25,15 +26,20 @@ import android.net.Uri;
import java.util.List;
/**
- * RcsMessageStore is the application interface to RcsProvider and provides access methods to
+ * RcsMessageManager is the application interface to RcsProvider and provides access methods to
* RCS related database tables.
*
* @hide
*/
-public class RcsMessageStore {
+@SystemService(Context.TELEPHONY_RCS_MESSAGE_SERVICE)
+public class RcsMessageManager {
RcsControllerCall mRcsControllerCall;
- RcsMessageStore(Context context) {
+ /**
+ * Use {@link Context#getSystemService(String)} to get an instance of this service.
+ * @hide
+ */
+ public RcsMessageManager(Context context) {
mRcsControllerCall = new RcsControllerCall(context);
}
diff --git a/telephony/java/android/telephony/ims/aidl/IRcs.aidl b/telephony/java/android/telephony/ims/aidl/IRcsMessage.aidl
index 9ee15daf67b9..0ae6303f024e 100644
--- a/telephony/java/android/telephony/ims/aidl/IRcs.aidl
+++ b/telephony/java/android/telephony/ims/aidl/IRcsMessage.aidl
@@ -35,7 +35,7 @@ import android.telephony.ims.RcsThreadQueryResultParcelable;
* RPC definition between RCS storage APIs and phone process.
* {@hide}
*/
-interface IRcs {
+interface IRcsMessage {
/////////////////////////
// RcsMessageStore APIs
/////////////////////////
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index a2dcc78585eb..dcfd193185cf 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -1087,6 +1087,11 @@ interface ITelephony {
String[] getMergedSubscriberIds(int subId, String callingPackage);
/**
+ * @hide
+ */
+ String[] getMergedSubscriberIdsFromGroup(int subId, String callingPackage);
+
+ /**
* Override the operator branding for the current ICCID.
*
* Once set, whenever the SIM is present in the device, the service
diff --git a/telephony/java/com/android/internal/telephony/TelephonyPermissions.java b/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
index 7a0ab9ca6a28..51c5d12dfe15 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
@@ -600,26 +600,21 @@ public final class TelephonyPermissions {
}
}
- /**
- * Returns whether the provided uid has carrier privileges for any active subscription ID.
- */
- private static boolean checkCarrierPrivilegeForAnySubId(Context context,
- Supplier<ITelephony> telephonySupplier, int uid) {
+ /** Returns whether the provided uid has carrier privileges for any active subscription ID. */
+ private static boolean checkCarrierPrivilegeForAnySubId(
+ Context context, Supplier<ITelephony> telephonySupplier, int uid) {
SubscriptionManager sm = (SubscriptionManager) context.getSystemService(
Context.TELEPHONY_SUBSCRIPTION_SERVICE);
- int[] activeSubIds = sm.getActiveSubscriptionIdList();
- if (activeSubIds != null) {
- for (int activeSubId : activeSubIds) {
- if (getCarrierPrivilegeStatus(telephonySupplier, activeSubId, uid)
- == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) {
- return true;
- }
+ int[] activeSubIds = sm.getActiveSubscriptionIdList(/* visibleOnly */ false);
+ for (int activeSubId : activeSubIds) {
+ if (getCarrierPrivilegeStatus(telephonySupplier, activeSubId, uid)
+ == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) {
+ return true;
}
}
return false;
}
-
private static int getCarrierPrivilegeStatus(
Supplier<ITelephony> telephonySupplier, int subId, int uid) {
ITelephony telephony = telephonySupplier.get();
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamBoolTest.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamBoolTest.java
index c21c4033a0ff..3415d2e13974 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamBoolTest.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamBoolTest.java
@@ -384,55 +384,55 @@ public class ProtoInputStreamBoolTest extends TestCase {
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamBytesTest.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamBytesTest.java
index 09fe40edda6c..8796807c0521 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamBytesTest.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamBytesTest.java
@@ -306,55 +306,55 @@ public class ProtoInputStreamBytesTest extends TestCase {
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamDoubleTest.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamDoubleTest.java
index 118fe3431e01..2b54e960eabb 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamDoubleTest.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamDoubleTest.java
@@ -611,55 +611,55 @@ public class ProtoInputStreamDoubleTest extends TestCase {
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamEnumTest.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamEnumTest.java
index f55d95129588..19bad7099622 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamEnumTest.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamEnumTest.java
@@ -454,55 +454,55 @@ public class ProtoInputStreamEnumTest extends TestCase {
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFixed32Test.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFixed32Test.java
index df68476f0c36..2bc61a0c7e8a 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFixed32Test.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFixed32Test.java
@@ -431,55 +431,55 @@ public class ProtoInputStreamFixed32Test extends TestCase {
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFixed64Test.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFixed64Test.java
index af4130b28cd8..a54ecf99d62c 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFixed64Test.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFixed64Test.java
@@ -532,55 +532,55 @@ public class ProtoInputStreamFixed64Test extends TestCase {
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFloatTest.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFloatTest.java
index 9bc07dc513e1..0477e9ea74e0 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFloatTest.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFloatTest.java
@@ -563,55 +563,55 @@ public class ProtoInputStreamFloatTest extends TestCase {
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamInt32Test.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamInt32Test.java
index 0065870486f2..a7f3f65e504d 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamInt32Test.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamInt32Test.java
@@ -449,55 +449,55 @@ public class ProtoInputStreamInt32Test extends TestCase {
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamInt64Test.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamInt64Test.java
index 4d6d105e60b0..dc42468e0605 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamInt64Test.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamInt64Test.java
@@ -529,55 +529,55 @@ public class ProtoInputStreamInt64Test extends TestCase {
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamObjectTest.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamObjectTest.java
index 5e49eeafb8af..1c0832e3e676 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamObjectTest.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamObjectTest.java
@@ -391,55 +391,55 @@ public class ProtoInputStreamObjectTest extends TestCase {
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSFixed32Test.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSFixed32Test.java
index 75c88a44614b..d349ea2baa67 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSFixed32Test.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSFixed32Test.java
@@ -431,55 +431,55 @@ public class ProtoInputStreamSFixed32Test extends TestCase {
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSFixed64Test.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSFixed64Test.java
index 4c65cf49318d..81a9c591b32e 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSFixed64Test.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSFixed64Test.java
@@ -531,55 +531,55 @@ public class ProtoInputStreamSFixed64Test extends TestCase {
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSInt32Test.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSInt32Test.java
index 6854cd8aad28..97194444deb2 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSInt32Test.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSInt32Test.java
@@ -431,55 +431,55 @@ public class ProtoInputStreamSInt32Test extends TestCase {
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSInt64Test.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSInt64Test.java
index c53e9d72562a..118476cdf235 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSInt64Test.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSInt64Test.java
@@ -506,55 +506,55 @@ public class ProtoInputStreamSInt64Test extends TestCase {
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamStringTest.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamStringTest.java
index 816d5f900a3d..51ee78f32767 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamStringTest.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamStringTest.java
@@ -287,55 +287,55 @@ public class ProtoInputStreamStringTest extends TestCase {
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamUInt32Test.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamUInt32Test.java
index 50fc537767a4..42f3e991f6e8 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamUInt32Test.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamUInt32Test.java
@@ -448,55 +448,55 @@ public class ProtoInputStreamUInt32Test extends TestCase {
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamUInt64Test.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamUInt64Test.java
index 20969e9056a9..8ba2c0ccaca9 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamUInt64Test.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamUInt64Test.java
@@ -525,55 +525,55 @@ public class ProtoInputStreamUInt64Test extends TestCase {
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tools/aapt2/cmd/Optimize.h b/tools/aapt2/cmd/Optimize.h
index 7f4a3ed85364..0be7dad18380 100644
--- a/tools/aapt2/cmd/Optimize.h
+++ b/tools/aapt2/cmd/Optimize.h
@@ -57,7 +57,7 @@ struct OptimizeOptions {
std::unordered_set<std::string> kept_artifacts;
// Whether or not to shorten resource paths in the APK.
- bool shorten_resource_paths;
+ bool shorten_resource_paths = false;
// Path to the output map of original resource paths to shortened paths.
Maybe<std::string> shortened_paths_map_path;
diff --git a/tools/preload2/Android.bp b/tools/preload2/Android.bp
new file mode 100644
index 000000000000..5809421da3e8
--- /dev/null
+++ b/tools/preload2/Android.bp
@@ -0,0 +1,50 @@
+// Copyright (C) 2015 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.
+
+java_library_host {
+ name: "preload2",
+
+ srcs: ["src/**/*.java"],
+
+ // To connect to devices (and take hprof dumps).
+ static_libs: [
+ "ddmlib-prebuilt",
+ "tools-common-prebuilt",
+
+ // To process hprof dumps.
+ "perflib-prebuilt",
+
+ "trove-prebuilt",
+ "guavalib",
+
+ // For JDWP access we use the framework in the JDWP tests from Apache Harmony, for
+ // convenience (and to not depend on internal JDK APIs).
+ "apache-harmony-jdwp-tests",
+ "junit",
+ ],
+
+ // Copy to build artifacts
+ dist: {
+ targets: [
+ "dist_files",
+ ],
+ },
+}
+
+// Copy the preload-tool shell script to the host's bin directory.
+sh_binary_host {
+ name: "preload-tool",
+ src: "preload-tool",
+ required: ["preload2"],
+}
diff --git a/tools/preload2/Android.mk b/tools/preload2/Android.mk
deleted file mode 100644
index d3ee1d370855..000000000000
--- a/tools/preload2/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under,src)
-
-# To connect to devices (and take hprof dumps).
-LOCAL_STATIC_JAVA_LIBRARIES := ddmlib-prebuilt tools-common-prebuilt
-
-# To process hprof dumps.
-LOCAL_STATIC_JAVA_LIBRARIES += perflib-prebuilt trove-prebuilt guavalib
-
-# For JDWP access we use the framework in the JDWP tests from Apache Harmony, for
-# convenience (and to not depend on internal JDK APIs).
-LOCAL_STATIC_JAVA_LIBRARIES += apache-harmony-jdwp-tests-host junit-host
-
-LOCAL_MODULE:= preload2
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-# Copy to build artifacts
-$(call dist-for-goals,dist_files,$(LOCAL_BUILT_MODULE):$(LOCAL_MODULE).jar)
-
-# Copy the preload-tool shell script to the host's bin directory.
-include $(CLEAR_VARS)
-LOCAL_IS_HOST_MODULE := true
-LOCAL_MODULE_CLASS := EXECUTABLES
-LOCAL_MODULE := preload-tool
-LOCAL_SRC_FILES := preload-tool
-LOCAL_REQUIRED_MODULES := preload2
-include $(BUILD_PREBUILT)