diff options
90 files changed, 917 insertions, 961 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/current.txt b/api/current.txt index 25801cac203e..7c13dc1293c1 100644 --- a/api/current.txt +++ b/api/current.txt @@ -5842,12 +5842,19 @@ package android.app { method public boolean updateAutomaticZenRule(String, android.app.AutomaticZenRule); field public static final String ACTION_APP_BLOCK_STATE_CHANGED = "android.app.action.APP_BLOCK_STATE_CHANGED"; field public static final String ACTION_AUTOMATIC_ZEN_RULE = "android.app.action.AUTOMATIC_ZEN_RULE"; + field public static final String ACTION_AUTOMATIC_ZEN_RULE_STATUS_CHANGED = "android.app.action.AUTOMATIC_ZEN_RULE_STATUS_CHANGED"; field public static final String ACTION_INTERRUPTION_FILTER_CHANGED = "android.app.action.INTERRUPTION_FILTER_CHANGED"; field public static final String ACTION_NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED = "android.app.action.NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED"; field public static final String ACTION_NOTIFICATION_CHANNEL_GROUP_BLOCK_STATE_CHANGED = "android.app.action.NOTIFICATION_CHANNEL_GROUP_BLOCK_STATE_CHANGED"; field public static final String ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED = "android.app.action.NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED"; field public static final String ACTION_NOTIFICATION_POLICY_CHANGED = "android.app.action.NOTIFICATION_POLICY_CHANGED"; + field public static final int AUTOMATIC_RULE_STATUS_DISABLED = 2; // 0x2 + field public static final int AUTOMATIC_RULE_STATUS_ENABLED = 1; // 0x1 + field public static final int AUTOMATIC_RULE_STATUS_REMOVED = 3; // 0x3 + field public static final int AUTOMATIC_RULE_STATUS_UNKNOWN = -1; // 0xffffffff field public static final String EXTRA_AUTOMATIC_RULE_ID = "android.app.extra.AUTOMATIC_RULE_ID"; + field public static final String EXTRA_AUTOMATIC_ZEN_RULE_ID = "android.app.extra.AUTOMATIC_ZEN_RULE_ID"; + field public static final String EXTRA_AUTOMATIC_ZEN_RULE_STATUS = "android.app.extra.AUTOMATIC_ZEN_RULE_STATUS"; field public static final String EXTRA_BLOCKED_STATE = "android.app.extra.BLOCKED_STATE"; field public static final String EXTRA_NOTIFICATION_CHANNEL_GROUP_ID = "android.app.extra.NOTIFICATION_CHANNEL_GROUP_ID"; field public static final String EXTRA_NOTIFICATION_CHANNEL_ID = "android.app.extra.NOTIFICATION_CHANNEL_ID"; 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/cmds/statsd/Android.bp b/cmds/statsd/Android.bp index 2f0dc3cb1e98..6df0a8e14f6a 100644 --- a/cmds/statsd/Android.bp +++ b/cmds/statsd/Android.bp @@ -71,7 +71,6 @@ cc_defaults { "src/config/ConfigManager.cpp", "src/external/GpuStatsPuller.cpp", "src/external/Perfetto.cpp", - "src/external/Perfprofd.cpp", "src/external/StatsPuller.cpp", "src/external/StatsCallbackPuller.cpp", "src/external/StatsCompanionServicePuller.cpp", @@ -109,8 +108,6 @@ cc_defaults { "src/socket/StatsSocketListener.cpp", "src/shell/ShellSubscriber.cpp", "src/shell/shell_config.proto", - - ":perfprofd_aidl", ], local_include_dirs: [ diff --git a/cmds/statsd/src/anomaly/subscriber_util.cpp b/cmds/statsd/src/anomaly/subscriber_util.cpp index 548a6869436d..e09d5751d323 100644 --- a/cmds/statsd/src/anomaly/subscriber_util.cpp +++ b/cmds/statsd/src/anomaly/subscriber_util.cpp @@ -22,7 +22,6 @@ #include <binder/IServiceManager.h> #include "external/Perfetto.h" -#include "external/Perfprofd.h" #include "subscriber/IncidentdReporter.h" #include "subscriber/SubscriberReporter.h" @@ -64,12 +63,6 @@ void triggerSubscribers(int64_t ruleId, int64_t metricId, const MetricDimensionK SubscriberReporter::getInstance().alertBroadcastSubscriber(configKey, subscription, dimensionKey); break; - case Subscription::SubscriberInformationCase::kPerfprofdDetails: - if (!CollectPerfprofdTraceAndUploadToDropbox(subscription.perfprofd_details(), - ruleId, configKey)) { - ALOGW("Failed to generate perfprofd traces."); - } - break; default: break; } diff --git a/cmds/statsd/src/external/Perfprofd.cpp b/cmds/statsd/src/external/Perfprofd.cpp deleted file mode 100644 index 1678f104a07a..000000000000 --- a/cmds/statsd/src/external/Perfprofd.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Perfprofd.h" - -#define DEBUG false // STOPSHIP if true -#include "config/ConfigKey.h" -#include "Log.h" - -#include <errno.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <unistd.h> - -#include <string> - -#include <binder/IServiceManager.h> - -#include "frameworks/base/cmds/statsd/src/statsd_config.pb.h" // Alert - -#include "android/os/IPerfProfd.h" - -namespace android { -namespace os { -namespace statsd { - -bool CollectPerfprofdTraceAndUploadToDropbox(const PerfprofdDetails& config, - int64_t alert_id, - const ConfigKey& configKey) { - VLOG("Starting trace collection through perfprofd"); - - if (!config.has_perfprofd_config()) { - ALOGE("The perfprofd trace config is empty, aborting"); - return false; - } - - sp<IPerfProfd> service = interface_cast<IPerfProfd>( - defaultServiceManager()->getService(android::String16("perfprofd"))); - if (service == NULL) { - ALOGE("Could not find perfprofd service"); - return false; - } - - auto* data = reinterpret_cast<const uint8_t*>(config.perfprofd_config().data()); - std::vector<uint8_t> proto_serialized(data, data + config.perfprofd_config().size()); - - // TODO: alert-id etc? - - binder::Status status = service->startProfilingProtobuf(proto_serialized); - if (status.isOk()) { - return true; - } - - ALOGE("Error starting perfprofd profiling: %s", status.toString8().c_str()); - return false; -} - -} // namespace statsd -} // namespace os -} // namespace android diff --git a/cmds/statsd/src/external/Perfprofd.h b/cmds/statsd/src/external/Perfprofd.h deleted file mode 100644 index b93fdf8e1cb2..000000000000 --- a/cmds/statsd/src/external/Perfprofd.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include <inttypes.h> - -namespace android { -namespace os { -namespace statsd { - -class ConfigKey; -class PerfprofdDetails; // Declared in statsd_config.pb.h - -// Starts the collection of a Perfprofd trace with the given |config|. -// The trace is uploaded to Dropbox by the perfprofd service once done. -// This method returns immediately after passing the config and does NOT wait -// for the full duration of the trace. -bool CollectPerfprofdTraceAndUploadToDropbox(const PerfprofdDetails& config, - int64_t alert_id, - const ConfigKey& configKey); - -} // namespace statsd -} // namespace os -} // namespace android diff --git a/cmds/statsd/src/statsd_config.proto b/cmds/statsd/src/statsd_config.proto index a2fd9d42f488..79c06b98a82d 100644 --- a/cmds/statsd/src/statsd_config.proto +++ b/cmds/statsd/src/statsd_config.proto @@ -343,15 +343,6 @@ message PerfettoDetails { optional bytes trace_config = 1; } -message PerfprofdDetails { - // The |perfprofd_config| field is a proto-encoded message of type - // android.perfprofd.ProfilingConfig defined in - // //system/extras/perfprofd/. On device, statsd doesn't need to - // deserialize the message as it's just passed binary-encoded to - // the perfprofd service. - optional bytes perfprofd_config = 1; -} - message BroadcastSubscriberDetails { optional int64 subscriber_id = 1; repeated string cookie = 2; @@ -373,10 +364,12 @@ message Subscription { IncidentdDetails incidentd_details = 4; PerfettoDetails perfetto_details = 5; BroadcastSubscriberDetails broadcast_subscriber_details = 6; - PerfprofdDetails perfprofd_details = 8; } optional float probability_of_informing = 7 [default = 1.1]; + + // This was used for perfprofd historically. + reserved 8; } enum ActivationType { diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java index c1cee77be16d..316cab8d600b 100644 --- a/core/java/android/app/NotificationManager.java +++ b/core/java/android/app/NotificationManager.java @@ -171,6 +171,78 @@ public class NotificationManager { "android.app.action.NOTIFICATION_CHANNEL_GROUP_BLOCK_STATE_CHANGED"; /** + * Intent that is broadcast when the status of an {@link AutomaticZenRule} has changed. + * + * <p>Use this to know whether you need to continue monitor to device state in order to + * provide up-to-date states (with {@link #setAutomaticZenRuleState(String, Condition)}) for + * this rule.</p> + * + * Input: nothing + * Output: {@link #EXTRA_AUTOMATIC_ZEN_RULE_ID} + * Output: {@link #EXTRA_AUTOMATIC_ZEN_RULE_STATUS} + */ + @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_AUTOMATIC_ZEN_RULE_STATUS_CHANGED = + "android.app.action.AUTOMATIC_ZEN_RULE_STATUS_CHANGED"; + + /** + * Integer extra for {@link #ACTION_AUTOMATIC_ZEN_RULE_STATUS_CHANGED} containing the state of + * the {@link AutomaticZenRule}. + * + * <p> + * The value will be one of {@link #AUTOMATIC_RULE_STATUS_ENABLED}, + * {@link #AUTOMATIC_RULE_STATUS_DISABLED}, {@link #AUTOMATIC_RULE_STATUS_REMOVED}, + * {@link #AUTOMATIC_RULE_STATUS_UNKNOWN}. + * </p> + */ + public static final String EXTRA_AUTOMATIC_ZEN_RULE_STATUS = + "android.app.extra.AUTOMATIC_ZEN_RULE_STATUS"; + + /** + * String extra for {@link #ACTION_AUTOMATIC_ZEN_RULE_STATUS_CHANGED} containing the id of the + * {@link AutomaticZenRule} (see {@link #addAutomaticZenRule(AutomaticZenRule)}) that has + * changed. + */ + public static final String EXTRA_AUTOMATIC_ZEN_RULE_ID = + "android.app.extra.AUTOMATIC_ZEN_RULE_ID"; + + /** @hide */ + @IntDef(prefix = { "AUTOMATIC_RULE_STATUS" }, value = { + AUTOMATIC_RULE_STATUS_ENABLED, AUTOMATIC_RULE_STATUS_DISABLED, + AUTOMATIC_RULE_STATUS_REMOVED, AUTOMATIC_RULE_STATUS_UNKNOWN + }) + @Retention(RetentionPolicy.SOURCE) + public @interface AutomaticZenRuleStatus {} + + /** + * Constant value for {@link #EXTRA_AUTOMATIC_ZEN_RULE_STATUS} - the current status of the + * rule is unknown at your target sdk version, and you should continue to provide state changes + * via {@link #setAutomaticZenRuleState(String, Condition)}. + */ + public static final int AUTOMATIC_RULE_STATUS_UNKNOWN = -1; + + /** + * Constant value for {@link #EXTRA_AUTOMATIC_ZEN_RULE_STATUS} - the given rule currently + * exists and is enabled. You should continue to provide state changes via + * {@link #setAutomaticZenRuleState(String, Condition)}. + */ + public static final int AUTOMATIC_RULE_STATUS_ENABLED = 1; + + /** + * Constant value for {@link #EXTRA_AUTOMATIC_ZEN_RULE_STATUS} - the given rule currently + * exists but is disabled. You do not need to continue to provide state changes via + * {@link #setAutomaticZenRuleState(String, Condition)} until the rule is reenabled. + */ + public static final int AUTOMATIC_RULE_STATUS_DISABLED = 2; + + /** + * Constant value for {@link #EXTRA_AUTOMATIC_ZEN_RULE_STATUS} - the given rule has been + * deleted. Further calls to {@link #setAutomaticZenRuleState(String, Condition)} will be + * ignored. + */ + public static final int AUTOMATIC_RULE_STATUS_REMOVED = 3; + + /** * Intent that is broadcast when the state of {@link #getEffectsSuppressor()} changes. * This broadcast is only sent to registered receivers. * 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/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/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java index 9b51c1239648..9d4cdc73b452 100644 --- a/core/java/com/android/internal/os/Zygote.java +++ b/core/java/com/android/internal/os/Zygote.java @@ -106,6 +106,14 @@ public final class Zygote { */ public static final int USE_APP_IMAGE_STARTUP_CACHE = 1 << 16; + /** + * When set, application specified signal handlers are not chained (i.e, ignored) + * by the runtime. + * + * Used for debugging only. Usage: set debug.ignoreappsignalhandler to 1. + */ + public static final int DEBUG_IGNORE_APP_SIGNAL_HANDLER = 1 << 17; + /** No external storage should be mounted. */ public static final int MOUNT_EXTERNAL_NONE = IVold.REMOUNT_MODE_NONE; /** Default external storage should be mounted. */ diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp index df98cdc9f1f9..0afbaa0e174c 100644 --- a/core/jni/android_util_Binder.cpp +++ b/core/jni/android_util_Binder.cpp @@ -99,7 +99,9 @@ static struct sparseintarray_offsets_t static struct error_offsets_t { - jclass mClass; + jclass mError; + jclass mOutOfMemory; + jclass mStackOverflow; } gErrorOffsets; // ---------------------------------------------------------------------------- @@ -207,6 +209,16 @@ static JNIEnv* javavm_to_jnienv(JavaVM* vm) return vm->GetEnv((void **)&env, JNI_VERSION_1_4) >= 0 ? env : NULL; } +static const char* GetErrorTypeName(JNIEnv* env, jthrowable error) { + if (env->IsInstanceOf(error, gErrorOffsets.mOutOfMemory)) { + return "OutOfMemoryError"; + } + if (env->IsInstanceOf(error, gErrorOffsets.mStackOverflow)) { + return "StackOverflowError"; + } + return nullptr; +} + // Report a java.lang.Error (or subclass). This will terminate the runtime by // calling FatalError with a message derived from the given error. static void report_java_lang_error_fatal_error(JNIEnv* env, jthrowable error, @@ -216,7 +228,7 @@ static void report_java_lang_error_fatal_error(JNIEnv* env, jthrowable error, // Try to get the exception string. Sometimes logcat isn't available, // so try to add it to the abort message. - std::string exc_msg = "(Unknown exception message)"; + std::string exc_msg; { ScopedLocalRef<jclass> exc_class(env, env->GetObjectClass(error)); jmethodID method_id = env->GetMethodID(exc_class.get(), "toString", @@ -225,15 +237,36 @@ static void report_java_lang_error_fatal_error(JNIEnv* env, jthrowable error, env, reinterpret_cast<jstring>( env->CallObjectMethod(error, method_id))); - env->ExceptionClear(); // Just for good measure. + ScopedLocalRef<jthrowable> new_error(env, nullptr); + bool got_jstr = false; + if (env->ExceptionCheck()) { + new_error = ScopedLocalRef<jthrowable>(env, env->ExceptionOccurred()); + env->ExceptionClear(); + } if (jstr.get() != nullptr) { ScopedUtfChars jstr_utf(env, jstr.get()); if (jstr_utf.c_str() != nullptr) { exc_msg = jstr_utf.c_str(); + got_jstr = true; } else { + new_error = ScopedLocalRef<jthrowable>(env, env->ExceptionOccurred()); env->ExceptionClear(); } } + if (!got_jstr) { + exc_msg = "(Unknown exception message)"; + const char* orig_type = GetErrorTypeName(env, error); + if (orig_type != nullptr) { + exc_msg = base::StringPrintf("%s (Error was %s)", exc_msg.c_str(), orig_type); + } + const char* new_type = + new_error == nullptr ? nullptr : GetErrorTypeName(env, new_error.get()); + if (new_type != nullptr) { + exc_msg = base::StringPrintf("%s (toString() error was %s)", + exc_msg.c_str(), + new_type); + } + } } env->Throw(error); @@ -291,7 +324,7 @@ static void report_exception(JNIEnv* env, jthrowable excep, const char* msg) ALOGE("%s", msg); } - if (env->IsInstanceOf(excep, gErrorOffsets.mClass)) { + if (env->IsInstanceOf(excep, gErrorOffsets.mError)) { report_java_lang_error(env, excep, msg); } } @@ -1440,10 +1473,13 @@ const char* const kBinderProxyPathName = "android/os/BinderProxy"; static int int_register_android_os_BinderProxy(JNIEnv* env) { - jclass clazz = FindClassOrDie(env, "java/lang/Error"); - gErrorOffsets.mClass = MakeGlobalRefOrDie(env, clazz); + gErrorOffsets.mError = MakeGlobalRefOrDie(env, FindClassOrDie(env, "java/lang/Error")); + gErrorOffsets.mOutOfMemory = + MakeGlobalRefOrDie(env, FindClassOrDie(env, "java/lang/OutOfMemoryError")); + gErrorOffsets.mStackOverflow = + MakeGlobalRefOrDie(env, FindClassOrDie(env, "java/lang/StackOverflowError")); - clazz = FindClassOrDie(env, kBinderProxyPathName); + jclass clazz = FindClassOrDie(env, kBinderProxyPathName); gBinderProxyOffsets.mClass = MakeGlobalRefOrDie(env, clazz); gBinderProxyOffsets.mGetInstance = GetStaticMethodIDOrDie(env, clazz, "getInstance", "(JJ)Landroid/os/BinderProxy;"); diff --git a/core/proto/android/server/jobscheduler.proto b/core/proto/android/server/jobscheduler.proto index 784e85414e00..c534aa419595 100644 --- a/core/proto/android/server/jobscheduler.proto +++ b/core/proto/android/server/jobscheduler.proto @@ -231,15 +231,6 @@ message ConstantsProto { // will use heartbeats, false will use a rolling window. optional bool use_heartbeats = 23; - message TimeController { - option (.android.msg_privacy).dest = DEST_AUTOMATIC; - - // Whether or not TimeController should skip setting wakeup alarms for jobs that aren't - // ready now. - optional bool skip_not_ready_jobs = 1; - } - optional TimeController time_controller = 25; - message QuotaController { option (.android.msg_privacy).dest = DEST_AUTOMATIC; @@ -304,6 +295,15 @@ message ConstantsProto { } optional QuotaController quota_controller = 24; + message TimeController { + option (.android.msg_privacy).dest = DEST_AUTOMATIC; + + // Whether or not TimeController should skip setting wakeup alarms for jobs that aren't + // ready now. + reserved 1; // skip_not_ready_jobs + } + optional TimeController time_controller = 25; + // Max number of jobs, when screen is ON. optional MaxJobCountsPerMemoryTrimLevelProto max_job_counts_screen_on = 26; diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 119d5ea33dc3..ebf5b9306c4a 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -536,6 +536,7 @@ <protected-broadcast android:name="android.app.action.INTERRUPTION_FILTER_CHANGED_INTERNAL" /> <protected-broadcast android:name="android.app.action.NOTIFICATION_POLICY_CHANGED" /> <protected-broadcast android:name="android.app.action.NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED" /> + <protected-broadcast android:name="android.app.action.AUTOMATIC_ZEN_RULE_STATUS_CHANGED" /> <protected-broadcast android:name="android.os.action.ACTION_EFFECTS_SUPPRESSOR_CHANGED" /> <protected-broadcast android:name="android.app.action.NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED" /> <protected-broadcast android:name="android.app.action.NOTIFICATION_CHANNEL_GROUP_BLOCK_STATE_CHANGED" /> 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/LayerDrawable.cpp b/libs/hwui/pipeline/skia/LayerDrawable.cpp index eed19420a78a..96b17e1d7975 100644 --- a/libs/hwui/pipeline/skia/LayerDrawable.cpp +++ b/libs/hwui/pipeline/skia/LayerDrawable.cpp @@ -33,21 +33,47 @@ void LayerDrawable::onDraw(SkCanvas* canvas) { } } -// This is a less-strict matrix.isTranslate() that will still report being translate-only -// on imperceptibly small scaleX & scaleY values. -static bool isBasicallyTranslate(const SkMatrix& matrix) { - if (!matrix.isScaleTranslate()) return false; - return MathUtils::isOne(matrix.getScaleX()) && MathUtils::isOne(matrix.getScaleY()); -} - -static bool shouldFilter(const SkMatrix& matrix) { - if (!matrix.isScaleTranslate()) return true; - - // We only care about meaningful scale here - bool noScale = MathUtils::isOne(matrix.getScaleX()) && MathUtils::isOne(matrix.getScaleY()); - bool pixelAligned = - SkScalarIsInt(matrix.getTranslateX()) && SkScalarIsInt(matrix.getTranslateY()); - return !(noScale && pixelAligned); +// Disable filtering when there is no scaling in screen coordinates and the corners have the same +// fraction (for translate) or zero fraction (for any other rect-to-rect transform). +static bool shouldFilterRect(const SkMatrix& matrix, const SkRect& srcRect, const SkRect& dstRect) { + if (!matrix.rectStaysRect()) return true; + SkRect dstDevRect = matrix.mapRect(dstRect); + float dstW, dstH; + bool requiresIntegerTranslate = false; + if (MathUtils::isZero(matrix.getScaleX()) && MathUtils::isZero(matrix.getScaleY())) { + // Has a 90 or 270 degree rotation, although total matrix may also have scale factors + // in m10 and m01. Those scalings are automatically handled by mapRect so comparing + // dimensions is sufficient, but swap width and height comparison. + dstW = dstDevRect.height(); + dstH = dstDevRect.width(); + requiresIntegerTranslate = true; + } else { + // Handle H/V flips or 180 rotation matrices. Axes may have been mirrored, but + // dimensions are still safe to compare directly. + dstW = dstDevRect.width(); + dstH = dstDevRect.height(); + requiresIntegerTranslate = + matrix.getScaleX() < -NON_ZERO_EPSILON || matrix.getScaleY() < -NON_ZERO_EPSILON; + } + if (!(MathUtils::areEqual(dstW, srcRect.width()) && + MathUtils::areEqual(dstH, srcRect.height()))) { + return true; + } + if (requiresIntegerTranslate) { + // Device rect and source rect should be integer aligned to ensure there's no difference + // in how nearest-neighbor sampling is resolved. + return !(MathUtils::isZero(SkScalarFraction(srcRect.x())) && + MathUtils::isZero(SkScalarFraction(srcRect.y())) && + MathUtils::isZero(SkScalarFraction(dstDevRect.x())) && + MathUtils::isZero(SkScalarFraction(dstDevRect.y()))); + } else { + // As long as src and device rects are translated by the same fractional amount, + // filtering won't be needed + return !(MathUtils::areEqual(SkScalarFraction(srcRect.x()), + SkScalarFraction(dstDevRect.x())) && + MathUtils::areEqual(SkScalarFraction(srcRect.y()), + SkScalarFraction(dstDevRect.y()))); + } } bool LayerDrawable::DrawLayer(GrContext* context, SkCanvas* canvas, Layer* layer, @@ -114,24 +140,21 @@ bool LayerDrawable::DrawLayer(GrContext* context, SkCanvas* canvas, Layer* layer skiaDestRect = SkRect::MakeIWH(layerWidth, layerHeight); } matrixInv.mapRect(&skiaDestRect); - // If (matrix is identity or an integer translation) and (src/dst buffers size match), + // If (matrix is a rect-to-rect transform) + // and (src/dst buffers size match in screen coordinates) + // and (src/dst corners align fractionally), // then use nearest neighbor, otherwise use bilerp sampling. - // Integer translation is defined as when src rect and dst rect align fractionally. // Skia TextureOp has the above logic build-in, but not NonAAFillRectOp. TextureOp works // only for SrcOver blending and without color filter (readback uses Src blending). - bool isIntegerTranslate = - isBasicallyTranslate(totalMatrix) && - SkScalarFraction(skiaDestRect.fLeft + totalMatrix[SkMatrix::kMTransX]) == - SkScalarFraction(skiaSrcRect.fLeft) && - SkScalarFraction(skiaDestRect.fTop + totalMatrix[SkMatrix::kMTransY]) == - SkScalarFraction(skiaSrcRect.fTop); - if (layer->getForceFilter() || !isIntegerTranslate) { + if (layer->getForceFilter() || + shouldFilterRect(totalMatrix, skiaSrcRect, skiaDestRect)) { paint.setFilterQuality(kLow_SkFilterQuality); } canvas->drawImageRect(layerImage.get(), skiaSrcRect, skiaDestRect, &paint, SkCanvas::kFast_SrcRectConstraint); } else { - if (layer->getForceFilter() || shouldFilter(totalMatrix)) { + SkRect imageRect = SkRect::MakeIWH(layerImage->width(), layerImage->height()); + if (layer->getForceFilter() || shouldFilterRect(totalMatrix, imageRect, imageRect)) { paint.setFilterQuality(kLow_SkFilterQuality); } canvas->drawImage(layerImage.get(), 0, 0, &paint); 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/SettingsProvider/src/com/android/providers/settings/GenerationRegistry.java b/packages/SettingsProvider/src/com/android/providers/settings/GenerationRegistry.java index 044ec867aef4..56173310a8bb 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/GenerationRegistry.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/GenerationRegistry.java @@ -22,14 +22,16 @@ import android.provider.Settings; import android.util.MemoryIntArray; import android.util.Slog; import android.util.SparseIntArray; + import com.android.internal.annotations.GuardedBy; import java.io.IOException; /** - * This class tracks changes for global/secure/system tables on a - * per user basis and updates a shared memory region which client - * processes can read to determine if their local caches are stale, + * This class tracks changes for config/global/secure/system tables + * on a per user basis and updates a shared memory region which + * client processes can read to determine if their local caches are + * stale. */ final class GenerationRegistry { private static final String LOG_TAG = "GenerationRegistry"; @@ -114,11 +116,12 @@ final class GenerationRegistry { @GuardedBy("mLock") private MemoryIntArray getBackingStoreLocked() { if (mBackingStore == null) { - // One for the global table, two for system and secure tables for a - // managed profile (managed profile is not included in the max user - // count), ten for partially deleted users if users are quickly removed, - // and twice max user count for system and secure. - final int size = 1 + 2 + 10 + 2 * UserManager.getMaxSupportedUsers(); + // One for the config table, one for the global table, two for system + // and secure tables for a managed profile (managed profile is not + // included in the max user count), ten for partially deleted users if + // users are quickly removed, and twice max user count for system and + // secure. + final int size = 1 + 1 + 2 + 10 + 2 * UserManager.getMaxSupportedUsers(); try { mBackingStore = new MemoryIntArray(size); if (DEBUG) { 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/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/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/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java index ffbc6b314776..5465309f7826 100644 --- a/services/core/java/com/android/server/am/ProcessList.java +++ b/services/core/java/com/android/server/am/ProcessList.java @@ -1526,6 +1526,9 @@ public final class ProcessList { if ("1".equals(SystemProperties.get("debug.assert"))) { runtimeFlags |= Zygote.DEBUG_ENABLE_ASSERT; } + if ("1".equals(SystemProperties.get("debug.ignoreappsignalhandler"))) { + runtimeFlags |= Zygote.DEBUG_IGNORE_APP_SIGNAL_HANDLER; + } if (mService.mNativeDebuggingApp != null && mService.mNativeDebuggingApp.equals(app.processName)) { // Enable all debug flags required by the native debugger. diff --git a/services/core/java/com/android/server/audio/AudioDeviceBroker.java b/services/core/java/com/android/server/audio/AudioDeviceBroker.java index 4d09c3b73a9d..cb6cf74d4f52 100644 --- a/services/core/java/com/android/server/audio/AudioDeviceBroker.java +++ b/services/core/java/com/android/server/audio/AudioDeviceBroker.java @@ -125,6 +125,8 @@ import java.io.PrintWriter; /*package*/ void onAudioServerDied() { // Restore forced usage for communications and record synchronized (mDeviceStateLock) { + AudioSystem.setParameters( + "BT_SCO=" + (mForcedUseForComm == AudioSystem.FORCE_BT_SCO ? "on" : "off")); onSetForceUse(AudioSystem.FOR_COMMUNICATION, mForcedUseForComm, "onAudioServerDied"); onSetForceUse(AudioSystem.FOR_RECORD, mForcedUseForComm, "onAudioServerDied"); } 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/job/controllers/TimeController.java b/services/core/java/com/android/server/job/controllers/TimeController.java index ababad961c2d..4c11947212f9 100644 --- a/services/core/java/com/android/server/job/controllers/TimeController.java +++ b/services/core/java/com/android/server/job/controllers/TimeController.java @@ -18,20 +18,13 @@ package com.android.server.job.controllers; import static com.android.server.job.JobSchedulerService.sElapsedRealtimeClock; -import android.annotation.NonNull; import android.annotation.Nullable; import android.app.AlarmManager; import android.app.AlarmManager.OnAlarmListener; -import android.content.ContentResolver; import android.content.Context; -import android.database.ContentObserver; -import android.net.Uri; -import android.os.Handler; import android.os.Process; import android.os.UserHandle; import android.os.WorkSource; -import android.provider.Settings; -import android.util.KeyValueListParser; import android.util.Log; import android.util.Slog; import android.util.TimeUtils; @@ -39,7 +32,6 @@ import android.util.proto.ProtoOutputStream; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.IndentingPrintWriter; -import com.android.server.job.ConstantsProto; import com.android.server.job.JobSchedulerService; import com.android.server.job.StateControllerProto; @@ -63,9 +55,6 @@ public final class TimeController extends StateController { /** Delay alarm tag for logging purposes */ private final String DELAY_TAG = "*job.delay*"; - private final Handler mHandler; - private final TcConstants mTcConstants; - private long mNextJobExpiredElapsedMillis; private long mNextDelayExpiredElapsedMillis; @@ -81,14 +70,6 @@ public final class TimeController extends StateController { mNextJobExpiredElapsedMillis = Long.MAX_VALUE; mNextDelayExpiredElapsedMillis = Long.MAX_VALUE; mChainedAttributionEnabled = mService.isChainedAttributionEnabled(); - - mHandler = new Handler(mContext.getMainLooper()); - mTcConstants = new TcConstants(mHandler); - } - - @Override - public void onSystemServicesReady() { - mTcConstants.start(mContext.getContentResolver()); } /** @@ -133,20 +114,16 @@ public final class TimeController extends StateController { job.setTrackingController(JobStatus.TRACKING_TIME); WorkSource ws = deriveWorkSource(job.getSourceUid(), job.getSourcePackageName()); - final long deadlineExpiredElapsed = - job.hasDeadlineConstraint() ? job.getLatestRunTimeElapsed() : Long.MAX_VALUE; - final long delayExpiredElapsed = - job.hasTimingDelayConstraint() ? job.getEarliestRunTime() : Long.MAX_VALUE; - if (mTcConstants.SKIP_NOT_READY_JOBS) { - if (wouldBeReadyWithConstraintLocked(job, JobStatus.CONSTRAINT_TIMING_DELAY)) { - maybeUpdateDelayAlarmLocked(delayExpiredElapsed, ws); - } - if (wouldBeReadyWithConstraintLocked(job, JobStatus.CONSTRAINT_DEADLINE)) { - maybeUpdateDeadlineAlarmLocked(deadlineExpiredElapsed, ws); - } - } else { - maybeUpdateDelayAlarmLocked(delayExpiredElapsed, ws); - maybeUpdateDeadlineAlarmLocked(deadlineExpiredElapsed, ws); + + // Only update alarms if the job would be ready with the relevant timing constraint + // satisfied. + if (job.hasTimingDelayConstraint() + && wouldBeReadyWithConstraintLocked(job, JobStatus.CONSTRAINT_TIMING_DELAY)) { + maybeUpdateDelayAlarmLocked(job.getEarliestRunTime(), ws); + } + if (job.hasDeadlineConstraint() + && wouldBeReadyWithConstraintLocked(job, JobStatus.CONSTRAINT_DEADLINE)) { + maybeUpdateDeadlineAlarmLocked(job.getLatestRunTimeElapsed(), ws); } } } @@ -168,10 +145,6 @@ public final class TimeController extends StateController { @Override public void evaluateStateLocked(JobStatus job) { - if (!mTcConstants.SKIP_NOT_READY_JOBS) { - return; - } - final long nowElapsedMillis = sElapsedRealtimeClock.millis(); // Check deadline constraint first because if it's satisfied, we avoid a little bit of @@ -261,9 +234,7 @@ public final class TimeController extends StateController { } it.remove(); } else { // Sorted by expiry time, so take the next one and stop. - if (mTcConstants.SKIP_NOT_READY_JOBS - && !wouldBeReadyWithConstraintLocked( - job, JobStatus.CONSTRAINT_DEADLINE)) { + if (!wouldBeReadyWithConstraintLocked(job, JobStatus.CONSTRAINT_DEADLINE)) { if (DEBUG) { Slog.i(TAG, "Skipping " + job + " because deadline won't make it ready."); @@ -321,9 +292,7 @@ public final class TimeController extends StateController { ready = true; } } else { - if (mTcConstants.SKIP_NOT_READY_JOBS - && !wouldBeReadyWithConstraintLocked( - job, JobStatus.CONSTRAINT_TIMING_DELAY)) { + if (!wouldBeReadyWithConstraintLocked(job, JobStatus.CONSTRAINT_TIMING_DELAY)) { if (DEBUG) { Slog.i(TAG, "Skipping " + job + " because delay won't make it ready."); @@ -458,81 +427,6 @@ public final class TimeController extends StateController { checkExpiredDelaysAndResetAlarm(); } - @VisibleForTesting - class TcConstants extends ContentObserver { - private ContentResolver mResolver; - private final KeyValueListParser mParser = new KeyValueListParser(','); - - private static final String KEY_SKIP_NOT_READY_JOBS = "skip_not_ready_jobs"; - - private static final boolean DEFAULT_SKIP_NOT_READY_JOBS = true; - - /** - * Whether or not TimeController should skip setting wakeup alarms for jobs that aren't - * ready now. - */ - public boolean SKIP_NOT_READY_JOBS = DEFAULT_SKIP_NOT_READY_JOBS; - - /** - * Creates a content observer. - * - * @param handler The handler to run {@link #onChange} on, or null if none. - */ - TcConstants(Handler handler) { - super(handler); - } - - private void start(ContentResolver resolver) { - mResolver = resolver; - mResolver.registerContentObserver(Settings.Global.getUriFor( - Settings.Global.JOB_SCHEDULER_TIME_CONTROLLER_CONSTANTS), false, this); - onChange(true, null); - } - - @Override - public void onChange(boolean selfChange, Uri uri) { - final String constants = Settings.Global.getString( - mResolver, Settings.Global.JOB_SCHEDULER_TIME_CONTROLLER_CONSTANTS); - - try { - mParser.setString(constants); - } catch (Exception e) { - // Failed to parse the settings string, log this and move on with defaults. - Slog.e(TAG, "Bad jobscheduler time controller settings", e); - } - - final boolean oldVal = SKIP_NOT_READY_JOBS; - SKIP_NOT_READY_JOBS = mParser.getBoolean( - KEY_SKIP_NOT_READY_JOBS, DEFAULT_SKIP_NOT_READY_JOBS); - - if (oldVal != SKIP_NOT_READY_JOBS) { - synchronized (mLock) { - recheckAlarmsLocked(); - } - } - } - - private void dump(IndentingPrintWriter pw) { - pw.println(); - pw.println("TimeController:"); - pw.increaseIndent(); - pw.printPair(KEY_SKIP_NOT_READY_JOBS, SKIP_NOT_READY_JOBS).println(); - pw.decreaseIndent(); - } - - private void dump(ProtoOutputStream proto) { - final long tcToken = proto.start(ConstantsProto.TIME_CONTROLLER); - proto.write(ConstantsProto.TimeController.SKIP_NOT_READY_JOBS, SKIP_NOT_READY_JOBS); - proto.end(tcToken); - } - } - - @VisibleForTesting - @NonNull - TcConstants getTcConstants() { - return mTcConstants; - } - @Override public void dumpControllerStateLocked(IndentingPrintWriter pw, Predicate<JobStatus> predicate) { @@ -607,14 +501,4 @@ public final class TimeController extends StateController { proto.end(mToken); proto.end(token); } - - @Override - public void dumpConstants(IndentingPrintWriter pw) { - mTcConstants.dump(pw); - } - - @Override - public void dumpConstants(ProtoOutputStream proto) { - mTcConstants.dump(proto); - } } diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java index d3346cddf3d0..5530b51042e3 100644 --- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java +++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java @@ -403,8 +403,10 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { private IConnectivityManager mConnManager; private PowerManagerInternal mPowerManagerInternal; private IDeviceIdleController mDeviceIdleController; + + /** Current cached value of the current Battery Saver mode's setting for restrict background. */ @GuardedBy("mUidRulesFirstLock") - private PowerSaveState mRestrictBackgroundPowerState; + private boolean mRestrictBackgroundLowPowerMode; // Store the status of restrict background before turning on battery saver. // Used to restore mRestrictBackground when battery saver is turned off. @@ -771,11 +773,9 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { // Update the restrictBackground if battery saver is turned on mRestrictBackgroundBeforeBsm = mLoadedRestrictBackground; - mRestrictBackgroundPowerState = mPowerManagerInternal - .getLowPowerState(ServiceType.DATA_SAVER); - final boolean localRestrictBackground = - mRestrictBackgroundPowerState.batterySaverEnabled; - if (localRestrictBackground && !mLoadedRestrictBackground) { + mRestrictBackgroundLowPowerMode = mPowerManagerInternal + .getLowPowerState(ServiceType.DATA_SAVER).batterySaverEnabled; + if (mRestrictBackgroundLowPowerMode && !mLoadedRestrictBackground) { mLoadedRestrictBackground = true; } mPowerManagerInternal.registerLowPowerModeObserver( @@ -2900,7 +2900,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { sendRestrictBackgroundChangedMsg(); mLogger.restrictBackgroundChanged(oldRestrictBackground, mRestrictBackground); - if (mRestrictBackgroundPowerState.globalBatterySaverEnabled) { + if (mRestrictBackgroundLowPowerMode) { mRestrictBackgroundChangedInBsm = true; } synchronized (mNetworkPoliciesSecondLock) { @@ -4907,17 +4907,21 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { @GuardedBy("mUidRulesFirstLock") @VisibleForTesting void updateRestrictBackgroundByLowPowerModeUL(final PowerSaveState result) { - mRestrictBackgroundPowerState = result; + if (mRestrictBackgroundLowPowerMode == result.batterySaverEnabled) { + // Nothing changed. Nothing to do. + return; + } + mRestrictBackgroundLowPowerMode = result.batterySaverEnabled; - boolean restrictBackground = result.batterySaverEnabled; + boolean restrictBackground = mRestrictBackgroundLowPowerMode; boolean shouldInvokeRestrictBackground; - // store the temporary mRestrictBackgroundChangedInBsm and update it at last + // store the temporary mRestrictBackgroundChangedInBsm and update it at the end. boolean localRestrictBgChangedInBsm = mRestrictBackgroundChangedInBsm; - if (result.globalBatterySaverEnabled) { + if (mRestrictBackgroundLowPowerMode) { // Try to turn on restrictBackground if (1) it is off and (2) batter saver need to // turn it on. - shouldInvokeRestrictBackground = !mRestrictBackground && result.batterySaverEnabled; + shouldInvokeRestrictBackground = !mRestrictBackground; mRestrictBackgroundBeforeBsm = mRestrictBackground; localRestrictBgChangedInBsm = false; } else { diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 976931c5e86b..07fd3228dec2 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -25,9 +25,12 @@ import static android.app.Notification.FLAG_NO_CLEAR; import static android.app.Notification.FLAG_ONGOING_EVENT; import static android.app.Notification.FLAG_ONLY_ALERT_ONCE; import static android.app.NotificationManager.ACTION_APP_BLOCK_STATE_CHANGED; +import static android.app.NotificationManager.ACTION_AUTOMATIC_ZEN_RULE_STATUS_CHANGED; import static android.app.NotificationManager.ACTION_NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED; import static android.app.NotificationManager.ACTION_NOTIFICATION_CHANNEL_GROUP_BLOCK_STATE_CHANGED; import static android.app.NotificationManager.ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED; +import static android.app.NotificationManager.EXTRA_AUTOMATIC_ZEN_RULE_ID; +import static android.app.NotificationManager.EXTRA_AUTOMATIC_ZEN_RULE_STATUS; import static android.app.NotificationManager.IMPORTANCE_LOW; import static android.app.NotificationManager.IMPORTANCE_MIN; import static android.app.NotificationManager.IMPORTANCE_NONE; @@ -1645,6 +1648,15 @@ public class NotificationManagerService extends SystemService { sendRegisteredOnlyBroadcast(NotificationManager.ACTION_NOTIFICATION_POLICY_CHANGED); mRankingHandler.requestSort(); } + + @Override + void onAutomaticRuleStatusChanged(int userId, String pkg, String id, int status) { + Intent intent = new Intent(ACTION_AUTOMATIC_ZEN_RULE_STATUS_CHANGED); + intent.setPackage(pkg); + intent.putExtra(EXTRA_AUTOMATIC_ZEN_RULE_ID, id); + intent.putExtra(EXTRA_AUTOMATIC_ZEN_RULE_STATUS, status); + getContext().sendBroadcastAsUser(intent, UserHandle.of(userId)); + } }); mPreferencesHelper = new PreferencesHelper(getContext(), mPackageManagerClient, diff --git a/services/core/java/com/android/server/notification/ZenModeHelper.java b/services/core/java/com/android/server/notification/ZenModeHelper.java index f81015dae468..ee948b28e546 100644 --- a/services/core/java/com/android/server/notification/ZenModeHelper.java +++ b/services/core/java/com/android/server/notification/ZenModeHelper.java @@ -16,6 +16,10 @@ package com.android.server.notification; +import static android.app.NotificationManager.AUTOMATIC_RULE_STATUS_DISABLED; +import static android.app.NotificationManager.AUTOMATIC_RULE_STATUS_ENABLED; +import static android.app.NotificationManager.AUTOMATIC_RULE_STATUS_REMOVED; + import android.app.AppOpsManager; import android.app.AutomaticZenRule; import android.app.Notification; @@ -351,6 +355,12 @@ public class ZenModeHelper { "Cannot update rules not owned by your condition provider"); } } + if (rule.enabled != automaticZenRule.isEnabled()) { + dispatchOnAutomaticRuleStatusChanged(mConfig.user, rule.pkg, ruleId, + automaticZenRule.isEnabled() + ? AUTOMATIC_RULE_STATUS_ENABLED : AUTOMATIC_RULE_STATUS_DISABLED); + } + populateZenRule(automaticZenRule, rule, false); return setConfigLocked(newConfig, reason, rule.component, true); } @@ -370,6 +380,8 @@ public class ZenModeHelper { throw new SecurityException( "Cannot delete rules not owned by your condition provider"); } + dispatchOnAutomaticRuleStatusChanged( + mConfig.user, rule.pkg, id, AUTOMATIC_RULE_STATUS_REMOVED); return setConfigLocked(newConfig, reason, null, true); } } @@ -1120,6 +1132,13 @@ public class ZenModeHelper { } } + private void dispatchOnAutomaticRuleStatusChanged(int userId, String pkg, String id, + int status) { + for (Callback callback : mCallbacks) { + callback.onAutomaticRuleStatusChanged(userId, pkg, id, status); + } + } + private ZenModeConfig readDefaultConfig(Resources resources) { XmlResourceParser parser = null; try { @@ -1509,5 +1528,6 @@ public class ZenModeHelper { void onZenModeChanged() {} void onPolicyChanged() {} void onConsolidatedPolicyChanged() {} + void onAutomaticRuleStatusChanged(int userId, String pkg, String id, int status) {} } } 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/tests/mockingservicestests/src/com/android/server/job/controllers/TimeControllerTest.java b/services/tests/mockingservicestests/src/com/android/server/job/controllers/TimeControllerTest.java index 70b7bb624920..3614763fecab 100644 --- a/services/tests/mockingservicestests/src/com/android/server/job/controllers/TimeControllerTest.java +++ b/services/tests/mockingservicestests/src/com/android/server/job/controllers/TimeControllerTest.java @@ -71,7 +71,6 @@ public class TimeControllerTest { private static final String SOURCE_PACKAGE = "com.android.frameworks.mockingservicestests"; private static final int SOURCE_USER_ID = 0; - private TimeController.TcConstants mConstants; private TimeController mTimeController; private MockitoSession mMockingSession; @@ -111,7 +110,6 @@ public class TimeControllerTest { // Initialize real objects. mTimeController = new TimeController(mJobSchedulerService); - mConstants = mTimeController.getTcConstants(); spyOn(mTimeController); } @@ -159,18 +157,7 @@ public class TimeControllerTest { } @Test - public void testMaybeStartTrackingJobLocked_DelayInOrder_NoSkipping() { - mConstants.SKIP_NOT_READY_JOBS = false; - mTimeController.onConstantsUpdatedLocked(); - - runTestMaybeStartTrackingJobLocked_DelayInOrder(); - } - - @Test - public void testMaybeStartTrackingJobLocked_DelayInOrder_WithSkipping_AllReady() { - mConstants.SKIP_NOT_READY_JOBS = true; - mTimeController.onConstantsUpdatedLocked(); - + public void testMaybeStartTrackingJobLocked_DelayInOrder_AllReady() { doReturn(true).when(mTimeController).wouldBeReadyWithConstraintLocked(any(), anyInt()); runTestMaybeStartTrackingJobLocked_DelayInOrder(); @@ -201,9 +188,7 @@ public class TimeControllerTest { } @Test - public void testMaybeStartTrackingJobLocked_DelayInOrder_WithSkipping_SomeNotReady() { - mConstants.SKIP_NOT_READY_JOBS = true; - mTimeController.onConstantsUpdatedLocked(); + public void testMaybeStartTrackingJobLocked_DelayInOrder_SomeNotReady() { final long now = JobSchedulerService.sElapsedRealtimeClock.millis(); JobStatus jobLatest = createJobStatus("testMaybeStartTrackingJobLocked_DelayInOrder", @@ -235,18 +220,7 @@ public class TimeControllerTest { } @Test - public void testMaybeStartTrackingJobLocked_DelayReverseOrder_NoSkipping() { - mConstants.SKIP_NOT_READY_JOBS = false; - mTimeController.onConstantsUpdatedLocked(); - - runTestMaybeStartTrackingJobLocked_DelayReverseOrder(); - } - - @Test - public void testMaybeStartTrackingJobLocked_DelayReverseOrder_WithSkipping_AllReady() { - mConstants.SKIP_NOT_READY_JOBS = true; - mTimeController.onConstantsUpdatedLocked(); - + public void testMaybeStartTrackingJobLocked_DelayReverseOrder_AllReady() { doReturn(true).when(mTimeController).wouldBeReadyWithConstraintLocked(any(), anyInt()); runTestMaybeStartTrackingJobLocked_DelayReverseOrder(); @@ -279,9 +253,7 @@ public class TimeControllerTest { } @Test - public void testMaybeStartTrackingJobLocked_DelayReverseOrder_WithSkipping_SomeNotReady() { - mConstants.SKIP_NOT_READY_JOBS = true; - mTimeController.onConstantsUpdatedLocked(); + public void testMaybeStartTrackingJobLocked_DelayReverseOrder_SomeNotReady() { final long now = JobSchedulerService.sElapsedRealtimeClock.millis(); JobStatus jobLatest = createJobStatus("testMaybeStartTrackingJobLocked_DelayReverseOrder", @@ -315,18 +287,7 @@ public class TimeControllerTest { } @Test - public void testMaybeStartTrackingJobLocked_DeadlineInOrder_NoSkipping() { - mConstants.SKIP_NOT_READY_JOBS = false; - mTimeController.onConstantsUpdatedLocked(); - - runTestMaybeStartTrackingJobLocked_DeadlineInOrder(); - } - - @Test - public void testMaybeStartTrackingJobLocked_DeadlineInOrder_WithSkipping_AllReady() { - mConstants.SKIP_NOT_READY_JOBS = true; - mTimeController.onConstantsUpdatedLocked(); - + public void testMaybeStartTrackingJobLocked_DeadlineInOrder_AllReady() { doReturn(true).when(mTimeController).wouldBeReadyWithConstraintLocked(any(), anyInt()); runTestMaybeStartTrackingJobLocked_DeadlineInOrder(); @@ -357,9 +318,7 @@ public class TimeControllerTest { } @Test - public void testMaybeStartTrackingJobLocked_DeadlineInOrder_WithSkipping_SomeNotReady() { - mConstants.SKIP_NOT_READY_JOBS = true; - mTimeController.onConstantsUpdatedLocked(); + public void testMaybeStartTrackingJobLocked_DeadlineInOrder_SomeNotReady() { final long now = JobSchedulerService.sElapsedRealtimeClock.millis(); JobStatus jobLatest = createJobStatus("testMaybeStartTrackingJobLocked_DeadlineInOrder", @@ -391,18 +350,7 @@ public class TimeControllerTest { } @Test - public void testMaybeStartTrackingJobLocked_DeadlineReverseOrder_NoSkipping() { - mConstants.SKIP_NOT_READY_JOBS = false; - mTimeController.onConstantsUpdatedLocked(); - - runTestMaybeStartTrackingJobLocked_DeadlineReverseOrder(); - } - - @Test - public void testMaybeStartTrackingJobLocked_DeadlineReverseOrder_WithSkipping_AllReady() { - mConstants.SKIP_NOT_READY_JOBS = true; - mTimeController.onConstantsUpdatedLocked(); - + public void testMaybeStartTrackingJobLocked_DeadlineReverseOrder_AllReady() { doReturn(true).when(mTimeController).wouldBeReadyWithConstraintLocked(any(), anyInt()); runTestMaybeStartTrackingJobLocked_DeadlineReverseOrder(); @@ -438,9 +386,7 @@ public class TimeControllerTest { } @Test - public void testMaybeStartTrackingJobLocked_DeadlineReverseOrder_WithSkipping_SomeNotReady() { - mConstants.SKIP_NOT_READY_JOBS = true; - mTimeController.onConstantsUpdatedLocked(); + public void testMaybeStartTrackingJobLocked_DeadlineReverseOrder_SomeNotReady() { final long now = JobSchedulerService.sElapsedRealtimeClock.millis(); JobStatus jobLatest = createJobStatus( @@ -478,62 +424,7 @@ public class TimeControllerTest { } @Test - public void testJobSkipToggling() { - final long now = JobSchedulerService.sElapsedRealtimeClock.millis(); - - JobStatus jobLatest = createJobStatus( - "testMaybeStartTrackingJobLocked_DeadlineReverseOrder", - createJob().setOverrideDeadline(HOUR_IN_MILLIS)); - JobStatus jobEarliest = createJobStatus( - "testMaybeStartTrackingJobLocked_DeadlineReverseOrder", - createJob().setOverrideDeadline(5 * MINUTE_IN_MILLIS)); - - doReturn(true).when(mTimeController) - .wouldBeReadyWithConstraintLocked(eq(jobLatest), anyInt()); - doReturn(false).when(mTimeController) - .wouldBeReadyWithConstraintLocked(eq(jobEarliest), anyInt()); - - // Starting off with the skipping off, we should still set an alarm for the earlier job. - mConstants.SKIP_NOT_READY_JOBS = false; - mTimeController.recheckAlarmsLocked(); - InOrder inOrder = inOrder(mAlarmManager); - - mTimeController.maybeStartTrackingJobLocked(jobEarliest, null); - mTimeController.maybeStartTrackingJobLocked(jobLatest, null); - inOrder.verify(mAlarmManager, times(1)) - .set(anyInt(), eq(now + 5 * MINUTE_IN_MILLIS), anyLong(), anyLong(), - eq(TAG_DEADLINE), any(), any(), any()); - - // Turn it on, use alarm for later job. - mConstants.SKIP_NOT_READY_JOBS = true; - mTimeController.recheckAlarmsLocked(); - - inOrder.verify(mAlarmManager, times(1)) - .set(anyInt(), eq(now + HOUR_IN_MILLIS), anyLong(), anyLong(), eq(TAG_DEADLINE), - any(), any(), any()); - - // Back off, use alarm for earlier job. - mConstants.SKIP_NOT_READY_JOBS = false; - mTimeController.recheckAlarmsLocked(); - - inOrder.verify(mAlarmManager, times(1)) - .set(anyInt(), eq(now + 5 * MINUTE_IN_MILLIS), anyLong(), anyLong(), - eq(TAG_DEADLINE), any(), any(), any()); - } - - @Test - public void testCheckExpiredDelaysAndResetAlarm_NoSkipping() { - mConstants.SKIP_NOT_READY_JOBS = false; - mTimeController.recheckAlarmsLocked(); - - runTestCheckExpiredDelaysAndResetAlarm(); - } - - @Test - public void testCheckExpiredDelaysAndResetAlarm_WithSkipping_AllReady() { - mConstants.SKIP_NOT_READY_JOBS = true; - mTimeController.recheckAlarmsLocked(); - + public void testCheckExpiredDelaysAndResetAlarm_AllReady() { doReturn(true).when(mTimeController).wouldBeReadyWithConstraintLocked(any(), anyInt()); runTestCheckExpiredDelaysAndResetAlarm(); @@ -589,9 +480,7 @@ public class TimeControllerTest { } @Test - public void testCheckExpiredDelaysAndResetAlarm_WithSkipping_SomeNotReady() { - mConstants.SKIP_NOT_READY_JOBS = true; - mTimeController.recheckAlarmsLocked(); + public void testCheckExpiredDelaysAndResetAlarm_SomeNotReady() { final long now = JobSchedulerService.sElapsedRealtimeClock.millis(); JobStatus jobLatest = createJobStatus("testCheckExpiredDelaysAndResetAlarm", @@ -639,18 +528,7 @@ public class TimeControllerTest { } @Test - public void testCheckExpiredDeadlinesAndResetAlarm_NoSkipping() { - mConstants.SKIP_NOT_READY_JOBS = false; - mTimeController.recheckAlarmsLocked(); - - runTestCheckExpiredDeadlinesAndResetAlarm(); - } - - @Test - public void testCheckExpiredDeadlinesAndResetAlarm_WithSkipping_AllReady() { - mConstants.SKIP_NOT_READY_JOBS = true; - mTimeController.recheckAlarmsLocked(); - + public void testCheckExpiredDeadlinesAndResetAlarm_AllReady() { doReturn(true).when(mTimeController).wouldBeReadyWithConstraintLocked(any(), anyInt()); runTestCheckExpiredDeadlinesAndResetAlarm(); @@ -706,9 +584,7 @@ public class TimeControllerTest { } @Test - public void testCheckExpiredDeadlinesAndResetAlarm_WithSkipping_SomeNotReady() { - mConstants.SKIP_NOT_READY_JOBS = true; - mTimeController.recheckAlarmsLocked(); + public void testCheckExpiredDeadlinesAndResetAlarm_SomeNotReady() { final long now = JobSchedulerService.sElapsedRealtimeClock.millis(); JobStatus jobLatest = createJobStatus("testCheckExpiredDeadlinesAndResetAlarm", @@ -756,28 +632,14 @@ public class TimeControllerTest { } @Test - public void testEvaluateStateLocked_SkippingOff() { - mConstants.SKIP_NOT_READY_JOBS = false; - mTimeController.recheckAlarmsLocked(); - JobStatus job = createJobStatus("testEvaluateStateLocked_SkippingOff", - createJob().setOverrideDeadline(HOUR_IN_MILLIS)); - - mTimeController.evaluateStateLocked(job); - verify(mAlarmManager, never()) - .set(anyInt(), anyLong(), anyLong(), anyLong(), anyString(), any(), any(), any()); - } - - @Test - public void testEvaluateStateLocked_SkippingOn_Delay() { - mConstants.SKIP_NOT_READY_JOBS = true; - mTimeController.recheckAlarmsLocked(); + public void testEvaluateStateLocked_Delay() { final long now = JobSchedulerService.sElapsedRealtimeClock.millis(); - JobStatus jobLatest = createJobStatus("testEvaluateStateLocked_SkippingOn_Delay", + JobStatus jobLatest = createJobStatus("testEvaluateStateLocked_Delay", createJob().setMinimumLatency(HOUR_IN_MILLIS)); - JobStatus jobMiddle = createJobStatus("testEvaluateStateLocked_SkippingOn_Delay", + JobStatus jobMiddle = createJobStatus("testEvaluateStateLocked_Delay", createJob().setMinimumLatency(30 * MINUTE_IN_MILLIS)); - JobStatus jobEarliest = createJobStatus("testEvaluateStateLocked_SkippingOn_Delay", + JobStatus jobEarliest = createJobStatus("testEvaluateStateLocked_Delay", createJob().setMinimumLatency(5 * MINUTE_IN_MILLIS)); doReturn(false).when(mTimeController) @@ -827,16 +689,14 @@ public class TimeControllerTest { } @Test - public void testEvaluateStateLocked_SkippingOn_Deadline() { - mConstants.SKIP_NOT_READY_JOBS = true; - mTimeController.recheckAlarmsLocked(); + public void testEvaluateStateLocked_Deadline() { final long now = JobSchedulerService.sElapsedRealtimeClock.millis(); - JobStatus jobLatest = createJobStatus("testEvaluateStateLocked_SkippingOn_Deadline", + JobStatus jobLatest = createJobStatus("testEvaluateStateLocked_Deadline", createJob().setOverrideDeadline(HOUR_IN_MILLIS)); - JobStatus jobMiddle = createJobStatus("testEvaluateStateLocked_SkippingOn_Deadline", + JobStatus jobMiddle = createJobStatus("testEvaluateStateLocked_Deadline", createJob().setOverrideDeadline(30 * MINUTE_IN_MILLIS)); - JobStatus jobEarliest = createJobStatus("testEvaluateStateLocked_SkippingOn_Deadline", + JobStatus jobEarliest = createJobStatus("testEvaluateStateLocked_Deadline", createJob().setOverrideDeadline(5 * MINUTE_IN_MILLIS)); doReturn(false).when(mTimeController) diff --git a/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java index ce1edcd584f6..09ae3a2628bf 100644 --- a/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java @@ -559,7 +559,25 @@ public class NetworkPolicyManagerServiceTest { .build(); mService.updateRestrictBackgroundByLowPowerModeUL(stateOff); - // RestrictBackground should be on, following its previous state + // RestrictBackground should be on, as before. + assertTrue(mService.getRestrictBackground()); + + stateOn = new PowerSaveState.Builder() + .setGlobalBatterySaverEnabled(true) + .setBatterySaverEnabled(true) + .build(); + mService.updateRestrictBackgroundByLowPowerModeUL(stateOn); + + // RestrictBackground should be on. + assertTrue(mService.getRestrictBackground()); + + stateOff = new PowerSaveState.Builder() + .setGlobalBatterySaverEnabled(false) + .setBatterySaverEnabled(false) + .build(); + mService.updateRestrictBackgroundByLowPowerModeUL(stateOff); + + // RestrictBackground should be on, as it was enabled manually before battery saver. assertTrue(mService.getRestrictBackground()); } @@ -585,6 +603,20 @@ public class NetworkPolicyManagerServiceTest { // RestrictBackground should be off, following its previous state assertFalse(mService.getRestrictBackground()); + + PowerSaveState stateOnRestrictOff = new PowerSaveState.Builder() + .setGlobalBatterySaverEnabled(true) + .setBatterySaverEnabled(false) + .build(); + + mService.updateRestrictBackgroundByLowPowerModeUL(stateOnRestrictOff); + + assertFalse(mService.getRestrictBackground()); + + mService.updateRestrictBackgroundByLowPowerModeUL(stateOff); + + // RestrictBackground should still be off. + assertFalse(mService.getRestrictBackground()); } @Test @@ -602,11 +634,49 @@ public class NetworkPolicyManagerServiceTest { // User turns off RestrictBackground manually setRestrictBackground(false); - PowerSaveState stateOff = new PowerSaveState.Builder().setBatterySaverEnabled( - false).build(); + // RestrictBackground should be off because user changed it manually + assertFalse(mService.getRestrictBackground()); + + PowerSaveState stateOff = new PowerSaveState.Builder() + .setGlobalBatterySaverEnabled(false) + .setBatterySaverEnabled(false) + .build(); + mService.updateRestrictBackgroundByLowPowerModeUL(stateOff); + + // RestrictBackground should remain off. + assertFalse(mService.getRestrictBackground()); + } + + @Test + public void updateRestrictBackgroundByLowPowerMode_RestrictOnWithGlobalOff() + throws Exception { + setRestrictBackground(false); + PowerSaveState stateOn = new PowerSaveState.Builder() + .setGlobalBatterySaverEnabled(false) + .setBatterySaverEnabled(true) + .build(); + + mService.updateRestrictBackgroundByLowPowerModeUL(stateOn); + + // RestrictBackground should be turned on because of battery saver. + assertTrue(mService.getRestrictBackground()); + + PowerSaveState stateRestrictOff = new PowerSaveState.Builder() + .setGlobalBatterySaverEnabled(true) + .setBatterySaverEnabled(false) + .build(); + mService.updateRestrictBackgroundByLowPowerModeUL(stateRestrictOff); + + // RestrictBackground should be off, returning to its state before battery saver's change. + assertFalse(mService.getRestrictBackground()); + + PowerSaveState stateOff = new PowerSaveState.Builder() + .setGlobalBatterySaverEnabled(false) + .setBatterySaverEnabled(false) + .build(); mService.updateRestrictBackgroundByLowPowerModeUL(stateOff); - // RestrictBackground should be off because user changes it manually + // RestrictBackground should still be off, back in its pre-battery saver state. assertFalse(mService.getRestrictBackground()); } 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/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/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; |