diff options
author | android-build-prod (mdb) <android-build-team-robot@google.com> | 2018-10-12 02:16:13 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-10-12 02:16:13 +0000 |
commit | 92f18ac3e398fcde834eec4f784adf26f3c3a931 (patch) | |
tree | 594a350054187192a9113b18d526a35c6f17be6a | |
parent | 403813782f89f9e4418fca6ef24ae394c1faebb9 (diff) | |
parent | 36533091e7252345d014d4615d6ee42c3c27cf61 (diff) | |
download | base-master-cuttlefish-testing-release.tar.gz |
Merge "Snap for 5061196 from 0d954557a107e3d5eee61c0b705fc8b4638a57f3 to master-cuttlefish-testing-release" into master-cuttlefish-testing-releasemaster-cuttlefish-testing-release
26 files changed, 304 insertions, 386 deletions
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto index c4824c084370..e12b665d1505 100644 --- a/cmds/statsd/src/atoms.proto +++ b/cmds/statsd/src/atoms.proto @@ -120,6 +120,8 @@ message Atom { AppCrashOccurred app_crash_occurred = 78; ANROccurred anr_occurred = 79; WTFOccurred wtf_occurred = 80; + PhoneServiceStateChanged phone_service_state_changed = 94; + PhoneStateChanged phone_state_changed = 95; LowMemReported low_mem_reported = 81; @@ -1137,6 +1139,33 @@ message PhoneSignalStrengthChanged { optional android.telephony.SignalStrengthEnum signal_strength = 1; } + +/** + * Logs when the phone state, sim state or signal strength changes + * + * Logged from: + * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java + */ +message PhoneServiceStateChanged { + optional android.telephony.ServiceStateEnum state = 1; + optional android.telephony.SimStateEnum sim_state = 2; + optional android.telephony.SignalStrengthEnum signal_strength = 3; +} + +/** + * Logs when the phone becomes on or off. + * + * Logged from: + * frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java + */ +message PhoneStateChanged { + enum State { + OFF = 0; + ON = 1; + } + optional State state = 1; +} + /** * Logs that a setting was updated. * Logged from: diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 5cbd18538fd1..35db667922ca 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -5132,6 +5132,7 @@ public abstract class PackageManager { * @param packageName The name of the package to query * @throws IllegalArgumentException if the given package name is not installed */ + @Nullable public abstract String getInstallerPackageName(String packageName); /** diff --git a/core/java/android/os/Message.java b/core/java/android/os/Message.java index b303e10fa64b..c3f60a332a2b 100644 --- a/core/java/android/os/Message.java +++ b/core/java/android/os/Message.java @@ -366,7 +366,7 @@ public final class Message implements Parcelable { * the <em>target</em> {@link Handler} that is receiving this Message to * dispatch it. If * not set, the message will be dispatched to the receiving Handler's - * {@link Handler#handleMessage(Message Handler.handleMessage())}. + * {@link Handler#handleMessage(Message)}. */ public Runnable getCallback() { return callback; diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java index 10c32a3b7a36..486c836279ce 100644 --- a/core/java/com/android/internal/os/BatteryStatsImpl.java +++ b/core/java/com/android/internal/os/BatteryStatsImpl.java @@ -5369,6 +5369,7 @@ public class BatteryStatsImpl extends BatteryStats { if (DEBUG_HISTORY) Slog.v(TAG, "Phone started scanning to: " + Integer.toHexString(mHistoryCur.states)); mPhoneSignalScanningTimer.startRunningLocked(elapsedRealtime); + StatsLog.write(StatsLog.PHONE_SERVICE_STATE_CHANGED, state, simState, strengthBin); } } @@ -5380,6 +5381,7 @@ public class BatteryStatsImpl extends BatteryStats { + Integer.toHexString(mHistoryCur.states)); newHistory = true; mPhoneSignalScanningTimer.stopRunningLocked(elapsedRealtime); + StatsLog.write(StatsLog.PHONE_SERVICE_STATE_CHANGED, state, simState, strengthBin); } } diff --git a/core/proto/android/telephony/enums.proto b/core/proto/android/telephony/enums.proto index 32975a5550f1..fba2e51937b3 100644 --- a/core/proto/android/telephony/enums.proto +++ b/core/proto/android/telephony/enums.proto @@ -61,3 +61,64 @@ enum SignalStrengthEnum { SIGNAL_STRENGTH_GOOD = 3; SIGNAL_STRENGTH_GREAT = 4; } + + +enum ServiceStateEnum { + /** + * Normal operation condition, the phone is registered + * with an operator either in home network or in roaming. + */ + SERVICE_STATE_IN_SERVICE = 0; + + /** + * Phone is not registered with any operator, the phone + * can be currently searching a new operator to register to, or not + * searching to registration at all, or registration is denied, or radio + * signal is not available. + */ + SERVICE_STATE_OUT_OF_SERVICE = 1; + + /** + * The phone is registered and locked. Only emergency numbers are allowed. {@more} + */ + SERVICE_STATE_EMERGENCY_ONLY = 2; + + /** + * Radio of telephony is explicitly powered off. + */ + SERVICE_STATE_POWER_OFF = 3; +} + +enum SimStateEnum { + SIM_STATE_UNKNOWN = 0; + /** SIM card state: no SIM card is available in the device */ + SIM_STATE_ABSENT = 1; + /** SIM card state: Locked: requires the user's SIM PIN to unlock */ + SIM_STATE_PIN_REQUIRED = 2; + /** SIM card state: Locked: requires the user's SIM PUK to unlock */ + SIM_STATE_PUK_REQUIRED = 3; + /** SIM card state: Locked: requires a network PIN to unlock */ + SIM_STATE_NETWORK_LOCKED = 4; + /** SIM card state: Ready */ + SIM_STATE_READY = 5; + /** SIM card state: SIM Card is NOT READY */ + SIM_STATE_NOT_READY = 6; + /** SIM card state: SIM Card Error, permanently disabled */ + SIM_STATE_PERM_DISABLED = 7; + /** SIM card state: SIM Card Error, present but faulty */ + SIM_STATE_CARD_IO_ERROR = 8; + /** SIM card state: SIM Card restricted, present but not usable due to + * carrier restrictions. + */ + SIM_STATE_CARD_RESTRICTED = 9; + /** + * SIM card state: Loaded: SIM card applications have been loaded + * @hide + */ + SIM_STATE_LOADED = 10; + /** + * SIM card state: SIM Card is present + * @hide + */ + SIM_STATE_PRESENT = 11; +} diff --git a/core/tests/coretests/Android.mk b/core/tests/coretests/Android.mk index e0d53933b33b..307e2e8671b2 100644 --- a/core/tests/coretests/Android.mk +++ b/core/tests/coretests/Android.mk @@ -67,10 +67,6 @@ LOCAL_RESOURCE_DIR := $(FrameworkCoreTests_intermediates) $(LOCAL_PATH)/res # Disable AAPT2 because the hacks below depend on the AAPT rules implementation LOCAL_USE_AAPT2 := false -# When AAPT2 is enabled it will need --warn-manifest-validation to fix: -# frameworks/base/core/tests/coretests/AndroidManifest.xml:26: error: unknown element <meta-data> found. -# TODO(b/79755007): Remove when AAPT2 recognizes the manifest elements. -# LOCAL_AAPT_FLAGS += --warn-manifest-validation include $(BUILD_PACKAGE) # Rules to copy all the test apks to the intermediate raw resource directory diff --git a/core/tests/coretests/apks/install_multi_package/Android.mk b/core/tests/coretests/apks/install_multi_package/Android.mk index 97275931be4b..3f163def9ce0 100644 --- a/core/tests/coretests/apks/install_multi_package/Android.mk +++ b/core/tests/coretests/apks/install_multi_package/Android.mk @@ -8,10 +8,6 @@ LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := install_multi_package LOCAL_USE_AAPT2 := true -# Disable AAPT2 manifest checks to fix: -# frameworks/base/core/tests/coretests/apks/install_multi_package/AndroidManifest.xml:46: error: unexpected element <package> found in <manifest>. -# TODO(b/79755007): Remove when AAPT2 recognizes the manifest elements. -LOCAL_AAPT_FLAGS += --warn-manifest-validation include $(FrameworkCoreTests_BUILD_PACKAGE) #include $(BUILD_PACKAGE) diff --git a/core/tests/coretests/apks/install_verifier_bad/Android.mk b/core/tests/coretests/apks/install_verifier_bad/Android.mk index 679327c9b0df..745b4d32ccc4 100644 --- a/core/tests/coretests/apks/install_verifier_bad/Android.mk +++ b/core/tests/coretests/apks/install_verifier_bad/Android.mk @@ -6,9 +6,5 @@ LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := install_verifier_bad LOCAL_USE_AAPT2 := true -# Disable AAPT2 manifest checks to fix: -# frameworks/base/core/tests/coretests/apks/install_verifier_bad/AndroidManifest.xml:19: error: unexpected element <package-verifier> found in <manifest>. -# TODO(b/79755007): Remove when AAPT2 recognizes the manifest elements. -LOCAL_AAPT_FLAGS += --warn-manifest-validation include $(FrameworkCoreTests_BUILD_PACKAGE) diff --git a/core/tests/coretests/apks/install_verifier_good/Android.mk b/core/tests/coretests/apks/install_verifier_good/Android.mk index 7d621b32900b..150fd8dd8701 100644 --- a/core/tests/coretests/apks/install_verifier_good/Android.mk +++ b/core/tests/coretests/apks/install_verifier_good/Android.mk @@ -6,9 +6,5 @@ LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := install_verifier_good LOCAL_USE_AAPT2 := true -# Disable AAPT2 manifest checks to fix: -# frameworks/base/core/tests/coretests/apks/install_verifier_good/AndroidManifest.xml:19: error: unexpected element <package-verifier> found in <manifest>. -# TODO(b/79755007): Remove when AAPT2 recognizes the manifest elements. -LOCAL_AAPT_FLAGS += --warn-manifest-validation include $(FrameworkCoreTests_BUILD_PACKAGE) diff --git a/core/tests/coretests/src/android/content/pm/dex/DexMetadataHelperTest.java b/core/tests/coretests/src/android/content/pm/dex/DexMetadataHelperTest.java index 584257b1f6a9..e248a7771cab 100644 --- a/core/tests/coretests/src/android/content/pm/dex/DexMetadataHelperTest.java +++ b/core/tests/coretests/src/android/content/pm/dex/DexMetadataHelperTest.java @@ -45,7 +45,7 @@ import java.util.Map; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; -import libcore.io.IoUtils; +import libcore.testing.io.TestIoUtils; import org.junit.After; import org.junit.Assert; @@ -63,7 +63,7 @@ public class DexMetadataHelperTest { @Before public void setUp() { - mTmpDir = IoUtils.createTemporaryDirectory("DexMetadataHelperTest"); + mTmpDir = TestIoUtils.createTemporaryDirectory("DexMetadataHelperTest"); } @After diff --git a/core/tests/coretests/src/android/os/FileUtilsTest.java b/core/tests/coretests/src/android/os/FileUtilsTest.java index 0bc3a2d879ab..17e34beb5215 100644 --- a/core/tests/coretests/src/android/os/FileUtilsTest.java +++ b/core/tests/coretests/src/android/os/FileUtilsTest.java @@ -32,7 +32,6 @@ import android.provider.DocumentsContract.Document; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; -import libcore.io.IoUtils; import libcore.io.Streams; import com.google.android.collect.Sets; @@ -79,7 +78,7 @@ public class FileUtilsTest { @After public void tearDown() throws Exception { - IoUtils.deleteContents(mDir); + FileUtils.deleteContents(mDir); FileUtils.deleteContents(mTarget); } diff --git a/core/tests/coretests/src/android/text/format/DateUtilsTest.java b/core/tests/coretests/src/android/text/format/DateUtilsTest.java index f8e3b4dfec56..872b71a5faa6 100644 --- a/core/tests/coretests/src/android/text/format/DateUtilsTest.java +++ b/core/tests/coretests/src/android/text/format/DateUtilsTest.java @@ -117,7 +117,7 @@ public class DateUtilsTest { @Test public void testFormatSameDayTime() { // This test assumes a default DateFormat.is24Hour setting. - DateFormat.is24Hour = null; + DateFormat.set24HourTimePref(null); Date date = new Date(109, 0, 19, 3, 30, 15); long fixedTime = date.getTime(); diff --git a/packages/CtsShim/build/Android.mk b/packages/CtsShim/build/Android.mk index e645adc60b7c..03eb0d9aad5a 100644 --- a/packages/CtsShim/build/Android.mk +++ b/packages/CtsShim/build/Android.mk @@ -67,10 +67,6 @@ LOCAL_MULTILIB := both LOCAL_JNI_SHARED_LIBRARIES := libshim_jni LOCAL_USE_AAPT2 := true -# Disable AAPT2 manifest checks to fix: -# out/target/common/obj/APPS/CtsShimPriv_intermediates/AndroidManifest.xml:25: error: unexpected element <restrict-update> found in <manifest>. -# TODO(b/79755007): Remove when AAPT2 recognizes the manifest elements. -LOCAL_AAPT_FLAGS += --warn-manifest-validation include $(BUILD_PACKAGE) @@ -113,10 +109,6 @@ LOCAL_PACKAGE_NAME := CtsShim LOCAL_MANIFEST_FILE := shim/AndroidManifest.xml LOCAL_USE_AAPT2 := true -# Disable AAPT2 manifest checks to fix: -# frameworks/base/packages/CtsShim/build/shim/AndroidManifest.xml:25: error: unexpected element <restrict-update> found in <manifest>. -# TODO(b/79755007): Remove when AAPT2 recognizes the manifest elements. -LOCAL_AAPT_FLAGS += --warn-manifest-validation include $(BUILD_PACKAGE) diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java index 0f9fe83ba6a5..c17a4cf43854 100644 --- a/services/core/java/com/android/server/TelephonyRegistry.java +++ b/services/core/java/com/android/server/TelephonyRegistry.java @@ -49,7 +49,9 @@ import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.telephony.VoLteServiceState; import android.util.LocalLog; +import android.util.StatsLog; +import com.android.internal.annotations.VisibleForTesting; import com.android.internal.app.IBatteryStats; import com.android.internal.telephony.IOnSubscriptionsChangedListener; import com.android.internal.telephony.IPhoneStateListener; @@ -82,7 +84,8 @@ import java.util.NoSuchElementException; * Eventually we may want to remove the notion of dummy value but for now this * looks like the best approach. */ -class TelephonyRegistry extends ITelephonyRegistry.Stub { +@VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) +public class TelephonyRegistry extends ITelephonyRegistry.Stub { private static final String TAG = "TelephonyRegistry"; private static final boolean DBG = false; // STOPSHIP if true private static final boolean DBG_LOC = false; // STOPSHIP if true @@ -324,7 +327,8 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { // calls go through a oneway interface and local calls going through a // handler before they get to app code. - TelephonyRegistry(Context context) { + @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) + public TelephonyRegistry(Context context) { CellLocation location = CellLocation.getEmpty(); mContext = context; @@ -1681,8 +1685,12 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { try { if (state == TelephonyManager.CALL_STATE_IDLE) { mBatteryStats.notePhoneOff(); + StatsLog.write(StatsLog.PHONE_STATE_CHANGED, + StatsLog.PHONE_STATE_CHANGED__STATE__OFF); } else { mBatteryStats.notePhoneOn(); + StatsLog.write(StatsLog.PHONE_STATE_CHANGED, + StatsLog.PHONE_STATE_CHANGED__STATE__ON); } } catch (RemoteException e) { /* The remote entity disappeared, we can safely ignore the exception. */ diff --git a/services/core/java/com/android/server/pm/dex/TEST_MAPPING b/services/core/java/com/android/server/pm/dex/TEST_MAPPING index ad5255904d20..c93af2a5ba41 100644 --- a/services/core/java/com/android/server/pm/dex/TEST_MAPPING +++ b/services/core/java/com/android/server/pm/dex/TEST_MAPPING @@ -1,19 +1,12 @@ { "presubmit": [ { - "name": "DexLoggerTests" - }, - { - "name": "DexManagerTests" - }, - { - "name": "DexoptOptionsTests" - }, - { - "name": "DexoptUtilsTest" - }, - { - "name": "PackageDexUsageTests" + "name": "FrameworksServicesTests", + "options": [ + { + "include-filter": "com.android.server.pm.dex" + } + ] }, { "name": "DexLoggerIntegrationTests" diff --git a/services/core/jni/Android.bp b/services/core/jni/Android.bp index 306f73aa704b..07cdd05ca893 100644 --- a/services/core/jni/Android.bp +++ b/services/core/jni/Android.bp @@ -57,17 +57,6 @@ cc_library_static { "frameworks/native/services", "system/gatekeeper/include", ], - - product_variables: { - arc: { - cflags: [ - "-DUSE_ARC", - ], - srcs: [ - "com_android_server_ArcVideoService.cpp", - ], - } - } } cc_defaults { @@ -142,7 +131,6 @@ cc_defaults { shared_libs: [ "libarcbridge", "libarcbridgeservice", - "libarcvideobridge", "libchrome", "libmojo", ], diff --git a/services/core/jni/com_android_server_ArcVideoService.cpp b/services/core/jni/com_android_server_ArcVideoService.cpp deleted file mode 100644 index f93cd905a584..000000000000 --- a/services/core/jni/com_android_server_ArcVideoService.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright 2016, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -//#define LOG_NDEBUG 0 -#define LOG_TAG "ArcVideoService" - -#include <binder/IPCThreadState.h> -#include <binder/IServiceManager.h> -#include <media/arcvideobridge/IArcVideoBridge.h> -#include <utils/Log.h> - -#include <base/bind.h> -#include <base/bind_helpers.h> -#include <mojo/edk/embedder/embedder.h> -#include <mojo/public/cpp/bindings/binding.h> - -#include <arc/ArcBridgeSupport.h> -#include <arc/ArcService.h> -#include <arc/Future.h> -#include <arc/IArcBridgeService.h> -#include <arc/MojoProcessSupport.h> -#include <components/arc/common/video.mojom.h> - -namespace { - -// [MinVersion] of OnVideoInstanceReady method in arc_bridge.mojom. -constexpr int kMinimumArcBridgeHostVersion = 6; - -void onCaptureResult(arc::Future<arc::MojoBootstrapResult>* future, uint32_t version, - mojo::ScopedHandle handle, const std::string& token) { - mojo::edk::ScopedPlatformHandle scoped_platform_handle; - MojoResult result = - mojo::edk::PassWrappedPlatformHandle(handle.release().value(), &scoped_platform_handle); - if (result != MOJO_RESULT_OK) { - ALOGE("Received invalid file descriptor."); - future->set(arc::MojoBootstrapResult()); - return; - } - - base::ScopedFD fd(scoped_platform_handle.release().handle); - future->set(arc::MojoBootstrapResult(std::move(fd), token, version)); -} - -} // namespace - -namespace arc { - -class VideoService : public mojom::VideoInstance, - public ArcService, - public android::BnArcVideoBridge { -public: - explicit VideoService(MojoProcessSupport* mojoProcessSupport) - : mMojoProcessSupport(mojoProcessSupport), mBinding(this) { - mMojoProcessSupport->arc_bridge_support().requestArcBridgeProxyAsync( - this, kMinimumArcBridgeHostVersion); - } - - ~VideoService() override { mMojoProcessSupport->disconnect(&mBinding, &mHostPtr); } - - // VideoInstance overrides: - void InitDeprecated(mojom::VideoHostPtr hostPtr) override { - Init(std::move(hostPtr), base::Bind(&base::DoNothing)); - } - - void Init(mojom::VideoHostPtr hostPtr, const InitCallback& callback) override { - ALOGV("Init"); - mHostPtr = std::move(hostPtr); - // A method must be called while we are still in a Mojo thread so the - // proxy can perform lazy initialization and be able to be called from - // non-Mojo threads later. - // This also caches the version number so it can be obtained by calling - // .version(). - mHostPtr.QueryVersion(base::Bind( - [](const InitCallback& callback, uint32_t version) { - ALOGI("VideoService ready (version=%d)", version); - callback.Run(); - }, - callback)); - ALOGV("Init done"); - } - - // ArcService overrides: - void ready(mojom::ArcBridgeHostPtr* bridgeHost) override { - (*bridgeHost)->OnVideoInstanceReady(mBinding.CreateInterfacePtrAndBind()); - } - - void versionMismatch(uint32_t version) override { - ALOGE("ArcBridgeHost version %d, does not support video (version %d)\n", version, - kMinimumArcBridgeHostVersion); - } - - // BnArcVideoBridge overrides: - MojoBootstrapResult bootstrapVideoAcceleratorFactory() override { - ALOGV("VideoService::bootstrapVideoAcceleratorFactory"); - - Future<MojoBootstrapResult> future; - mMojoProcessSupport->mojo_thread().getTaskRunner()->PostTask( - FROM_HERE, base::Bind(&VideoService::bootstrapVideoAcceleratorFactoryOnMojoThread, - base::Unretained(this), &future)); - return future.get(); - } - - int32_t hostVersion() override { - ALOGV("VideoService::hostVersion"); - return mHostPtr.version(); - } - -private: - void bootstrapVideoAcceleratorFactoryOnMojoThread(Future<MojoBootstrapResult>* future) { - if (!mHostPtr) { - ALOGE("mHostPtr is not ready yet"); - future->set(MojoBootstrapResult()); - return; - } - mHostPtr->OnBootstrapVideoAcceleratorFactory( - base::Bind(&onCaptureResult, base::Unretained(future), mHostPtr.version())); - } - - // Outlives VideoService. - MojoProcessSupport* const mMojoProcessSupport; - mojo::Binding<mojom::VideoInstance> mBinding; - mojom::VideoHostPtr mHostPtr; -}; - -} // namespace arc - -namespace android { - -int register_android_server_ArcVideoService() { - defaultServiceManager()->addService( - String16("android.os.IArcVideoBridge"), - new arc::VideoService(arc::MojoProcessSupport::getLeakyInstance())); - return 0; -} - -} // namespace android diff --git a/services/core/jni/onload.cpp b/services/core/jni/onload.cpp index 0ebef37c1f2f..bb6e6840f3b4 100644 --- a/services/core/jni/onload.cpp +++ b/services/core/jni/onload.cpp @@ -54,9 +54,6 @@ int register_android_server_SyntheticPasswordManager(JNIEnv* env); int register_android_server_GraphicsStatsService(JNIEnv* env); int register_android_hardware_display_DisplayViewport(JNIEnv* env); int register_android_server_net_NetworkStatsService(JNIEnv* env); -#ifdef USE_ARC -int register_android_server_ArcVideoService(); -#endif }; using namespace android; @@ -104,8 +101,5 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void* /* reserved */) register_android_server_GraphicsStatsService(env); register_android_hardware_display_DisplayViewport(env); register_android_server_net_NetworkStatsService(env); -#ifdef USE_ARC - register_android_server_ArcVideoService(); -#endif return JNI_VERSION_1_4; } diff --git a/telephony/java/android/telephony/NeighboringCellInfo.java b/telephony/java/android/telephony/NeighboringCellInfo.java index 79298fd54c50..ac38efb4d029 100644 --- a/telephony/java/android/telephony/NeighboringCellInfo.java +++ b/telephony/java/android/telephony/NeighboringCellInfo.java @@ -34,8 +34,8 @@ import android.os.Parcelable; * Received Signal Strength and Cell ID location. * * @deprecated This class should not be used by any app targeting - * {@link Build.VERSION_CODES.Q Android Q} or higher. Instead callers should use - * {@Link android.telephony.CellInfo CellInfo}. + * {@link android.os.Build.VERSION_CODES#Q Android Q} or higher. Instead callers should use + * {@link android.telephony.CellInfo CellInfo}. */ @Deprecated public class NeighboringCellInfo implements Parcelable diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java index bd6a59d7492c..498be968265f 100644 --- a/telephony/java/android/telephony/PhoneStateListener.java +++ b/telephony/java/android/telephony/PhoneStateListener.java @@ -23,6 +23,7 @@ import android.os.Handler; import android.os.Looper; import android.os.Message; +import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.IPhoneStateListener; import java.lang.ref.WeakReference; @@ -778,8 +779,12 @@ public class PhoneStateListener { } } + /** + * @hide + */ + @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) @UnsupportedAppUsage - IPhoneStateListener callback = new IPhoneStateListenerStub(this); + public final IPhoneStateListener callback = new IPhoneStateListenerStub(this); private void log(String s) { Rlog.d(LOG_TAG, s); diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index 7469186a5d51..60e103aa62e0 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -57,7 +57,7 @@ public class ServiceState implements Parcelable { * Normal operation condition, the phone is registered * with an operator either in home network or in roaming. */ - public static final int STATE_IN_SERVICE = 0; + public static final int STATE_IN_SERVICE = TelephonyProtoEnums.SERVICE_STATE_IN_SERVICE; // 0 /** * Phone is not registered with any operator, the phone @@ -65,17 +65,19 @@ public class ServiceState implements Parcelable { * searching to registration at all, or registration is denied, or radio * signal is not available. */ - public static final int STATE_OUT_OF_SERVICE = 1; + public static final int STATE_OUT_OF_SERVICE = + TelephonyProtoEnums.SERVICE_STATE_OUT_OF_SERVICE; // 1 /** * The phone is registered and locked. Only emergency numbers are allowed. {@more} */ - public static final int STATE_EMERGENCY_ONLY = 2; + public static final int STATE_EMERGENCY_ONLY = + TelephonyProtoEnums.SERVICE_STATE_EMERGENCY_ONLY; // 2 /** * Radio of telephony is explicitly powered off. */ - public static final int STATE_POWER_OFF = 3; + public static final int STATE_POWER_OFF = TelephonyProtoEnums.SERVICE_STATE_POWER_OFF; // 3 /** @hide */ @Retention(RetentionPolicy.SOURCE) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 48f38fca9266..13cdc58175e3 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -2418,39 +2418,46 @@ public class TelephonyManager { * * These are the ordinal value of IccCardConstants.State. */ - public static final int SIM_STATE_UNKNOWN = 0; + + public static final int SIM_STATE_UNKNOWN = TelephonyProtoEnums.SIM_STATE_UNKNOWN; // 0 /** SIM card state: no SIM card is available in the device */ - public static final int SIM_STATE_ABSENT = 1; + public static final int SIM_STATE_ABSENT = TelephonyProtoEnums.SIM_STATE_ABSENT; // 1 /** SIM card state: Locked: requires the user's SIM PIN to unlock */ - public static final int SIM_STATE_PIN_REQUIRED = 2; + public static final int SIM_STATE_PIN_REQUIRED = + TelephonyProtoEnums.SIM_STATE_PIN_REQUIRED; // 2 /** SIM card state: Locked: requires the user's SIM PUK to unlock */ - public static final int SIM_STATE_PUK_REQUIRED = 3; + public static final int SIM_STATE_PUK_REQUIRED = + TelephonyProtoEnums.SIM_STATE_PUK_REQUIRED; // 3 /** SIM card state: Locked: requires a network PIN to unlock */ - public static final int SIM_STATE_NETWORK_LOCKED = 4; + public static final int SIM_STATE_NETWORK_LOCKED = + TelephonyProtoEnums.SIM_STATE_NETWORK_LOCKED; // 4 /** SIM card state: Ready */ - public static final int SIM_STATE_READY = 5; + public static final int SIM_STATE_READY = TelephonyProtoEnums.SIM_STATE_READY; // 5 /** SIM card state: SIM Card is NOT READY */ - public static final int SIM_STATE_NOT_READY = 6; + public static final int SIM_STATE_NOT_READY = TelephonyProtoEnums.SIM_STATE_NOT_READY; // 6 /** SIM card state: SIM Card Error, permanently disabled */ - public static final int SIM_STATE_PERM_DISABLED = 7; + public static final int SIM_STATE_PERM_DISABLED = + TelephonyProtoEnums.SIM_STATE_PERM_DISABLED; // 7 /** SIM card state: SIM Card Error, present but faulty */ - public static final int SIM_STATE_CARD_IO_ERROR = 8; + public static final int SIM_STATE_CARD_IO_ERROR = + TelephonyProtoEnums.SIM_STATE_CARD_IO_ERROR; // 8 /** SIM card state: SIM Card restricted, present but not usable due to * carrier restrictions. */ - public static final int SIM_STATE_CARD_RESTRICTED = 9; + public static final int SIM_STATE_CARD_RESTRICTED = + TelephonyProtoEnums.SIM_STATE_CARD_RESTRICTED; // 9 /** * SIM card state: Loaded: SIM card applications have been loaded * @hide */ @SystemApi - public static final int SIM_STATE_LOADED = 10; + public static final int SIM_STATE_LOADED = TelephonyProtoEnums.SIM_STATE_LOADED; // 10 /** * SIM card state: SIM Card is present * @hide */ @SystemApi - public static final int SIM_STATE_PRESENT = 11; + public static final int SIM_STATE_PRESENT = TelephonyProtoEnums.SIM_STATE_PRESENT; // 11 /** * Extra included in {@link #ACTION_SIM_CARD_STATE_CHANGED} and diff --git a/telephony/java/android/telephony/data/ApnSetting.java b/telephony/java/android/telephony/data/ApnSetting.java index 951bed468eda..8379f8cefda0 100644 --- a/telephony/java/android/telephony/data/ApnSetting.java +++ b/telephony/java/android/telephony/data/ApnSetting.java @@ -634,33 +634,33 @@ public class ApnSetting implements Parcelable { int maxConns, int waitTime, int maxConnsTime, int mtu, int mvnoType, String mvnoMatchData, int apnSetId) { return new Builder() - .setId(id) - .setOperatorNumeric(operatorNumeric) - .setEntryName(entryName) - .setApnName(apnName) - .setProxyAddress(proxyAddress) - .setProxyPort(proxyPort) - .setMmsc(mmsc) - .setMmsProxyAddress(mmsProxyAddress) - .setMmsProxyPort(mmsProxyPort) - .setUser(user) - .setPassword(password) - .setAuthType(authType) - .setApnTypeBitmask(mApnTypeBitmask) - .setProtocol(protocol) - .setRoamingProtocol(roamingProtocol) - .setCarrierEnabled(carrierEnabled) - .setNetworkTypeBitmask(networkTypeBitmask) - .setProfileId(profileId) - .setModemCognitive(modemCognitive) - .setMaxConns(maxConns) - .setWaitTime(waitTime) - .setMaxConnsTime(maxConnsTime) - .setMtu(mtu) - .setMvnoType(mvnoType) - .setMvnoMatchData(mvnoMatchData) - .setApnSetId(apnSetId) - .buildWithoutCheck(); + .setId(id) + .setOperatorNumeric(operatorNumeric) + .setEntryName(entryName) + .setApnName(apnName) + .setProxyAddress(proxyAddress) + .setProxyPort(proxyPort) + .setMmsc(mmsc) + .setMmsProxyAddress(mmsProxyAddress) + .setMmsProxyPort(mmsProxyPort) + .setUser(user) + .setPassword(password) + .setAuthType(authType) + .setApnTypeBitmask(mApnTypeBitmask) + .setProtocol(protocol) + .setRoamingProtocol(roamingProtocol) + .setCarrierEnabled(carrierEnabled) + .setNetworkTypeBitmask(networkTypeBitmask) + .setProfileId(profileId) + .setModemCognitive(modemCognitive) + .setMaxConns(maxConns) + .setWaitTime(waitTime) + .setMaxConnsTime(maxConnsTime) + .setMtu(mtu) + .setMvnoType(mvnoType) + .setMvnoMatchData(mvnoMatchData) + .setApnSetId(apnSetId) + .buildWithoutCheck(); } /** @hide */ @@ -692,56 +692,56 @@ public class ApnSetting implements Parcelable { } return makeApnSetting( - cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers._ID)), - cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.NUMERIC)), - cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.NAME)), - cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.APN)), - cursor.getString( - cursor.getColumnIndexOrThrow(Telephony.Carriers.PROXY)), - portFromString(cursor.getString( - cursor.getColumnIndexOrThrow(Telephony.Carriers.PORT))), - UriFromString(cursor.getString( - cursor.getColumnIndexOrThrow(Telephony.Carriers.MMSC))), - cursor.getString( - cursor.getColumnIndexOrThrow(Telephony.Carriers.MMSPROXY)), - portFromString(cursor.getString( - cursor.getColumnIndexOrThrow(Telephony.Carriers.MMSPORT))), - cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.USER)), - cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.PASSWORD)), - cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.AUTH_TYPE)), - apnTypesBitmask, - getProtocolIntFromString( - cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.PROTOCOL))), - getProtocolIntFromString( + cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers._ID)), + cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.NUMERIC)), + cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.NAME)), + cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.APN)), + cursor.getString( + cursor.getColumnIndexOrThrow(Telephony.Carriers.PROXY)), + portFromString(cursor.getString( + cursor.getColumnIndexOrThrow(Telephony.Carriers.PORT))), + UriFromString(cursor.getString( + cursor.getColumnIndexOrThrow(Telephony.Carriers.MMSC))), + cursor.getString( + cursor.getColumnIndexOrThrow(Telephony.Carriers.MMSPROXY)), + portFromString(cursor.getString( + cursor.getColumnIndexOrThrow(Telephony.Carriers.MMSPORT))), + cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.USER)), + cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.PASSWORD)), + cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.AUTH_TYPE)), + apnTypesBitmask, + getProtocolIntFromString( + cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.PROTOCOL))), + getProtocolIntFromString( + cursor.getString(cursor.getColumnIndexOrThrow( + Telephony.Carriers.ROAMING_PROTOCOL))), + cursor.getInt(cursor.getColumnIndexOrThrow( + Telephony.Carriers.CARRIER_ENABLED)) == 1, + networkTypeBitmask, + cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.PROFILE_ID)), + cursor.getInt(cursor.getColumnIndexOrThrow( + Telephony.Carriers.MODEM_COGNITIVE)) == 1, + cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.MAX_CONNS)), + cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.WAIT_TIME)), + cursor.getInt(cursor.getColumnIndexOrThrow( + Telephony.Carriers.MAX_CONNS_TIME)), + cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.MTU)), + getMvnoTypeIntFromString( + cursor.getString(cursor.getColumnIndexOrThrow( + Telephony.Carriers.MVNO_TYPE))), cursor.getString(cursor.getColumnIndexOrThrow( - Telephony.Carriers.ROAMING_PROTOCOL))), - cursor.getInt(cursor.getColumnIndexOrThrow( - Telephony.Carriers.CARRIER_ENABLED)) == 1, - networkTypeBitmask, - cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.PROFILE_ID)), - cursor.getInt(cursor.getColumnIndexOrThrow( - Telephony.Carriers.MODEM_COGNITIVE)) == 1, - cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.MAX_CONNS)), - cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.WAIT_TIME)), - cursor.getInt(cursor.getColumnIndexOrThrow( - Telephony.Carriers.MAX_CONNS_TIME)), - cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.MTU)), - getMvnoTypeIntFromString( - cursor.getString(cursor.getColumnIndexOrThrow( - Telephony.Carriers.MVNO_TYPE))), - cursor.getString(cursor.getColumnIndexOrThrow( - Telephony.Carriers.MVNO_MATCH_DATA)), - cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.APN_SET_ID))); + Telephony.Carriers.MVNO_MATCH_DATA)), + cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.APN_SET_ID))); } /** @hide */ public static ApnSetting makeApnSetting(ApnSetting apn) { return makeApnSetting(apn.mId, apn.mOperatorNumeric, apn.mEntryName, apn.mApnName, - apn.mProxyAddress, apn.mProxyPort, apn.mMmsc, apn.mMmsProxyAddress, - apn.mMmsProxyPort, apn.mUser, apn.mPassword, apn.mAuthType, apn.mApnTypeBitmask, - apn.mProtocol, apn.mRoamingProtocol, apn.mCarrierEnabled, apn.mNetworkTypeBitmask, - apn.mProfileId, apn.mModemCognitive, apn.mMaxConns, apn.mWaitTime, - apn.mMaxConnsTime, apn.mMtu, apn.mMvnoType, apn.mMvnoMatchData, apn.mApnSetId); + apn.mProxyAddress, apn.mProxyPort, apn.mMmsc, apn.mMmsProxyAddress, + apn.mMmsProxyPort, apn.mUser, apn.mPassword, apn.mAuthType, apn.mApnTypeBitmask, + apn.mProtocol, apn.mRoamingProtocol, apn.mCarrierEnabled, apn.mNetworkTypeBitmask, + apn.mProfileId, apn.mModemCognitive, apn.mMaxConns, apn.mWaitTime, + apn.mMaxConnsTime, apn.mMtu, apn.mMvnoType, apn.mMvnoMatchData, apn.mApnSetId); } /** @@ -931,16 +931,16 @@ public class ApnSetting implements Parcelable { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("[ApnSettingV5] ") - .append(mEntryName) - .append(", ").append(mId) - .append(", ").append(mOperatorNumeric) - .append(", ").append(mApnName) - .append(", ").append(mProxyAddress) - .append(", ").append(UriToString(mMmsc)) - .append(", ").append(mMmsProxyAddress) - .append(", ").append(portToString(mMmsProxyPort)) - .append(", ").append(portToString(mProxyPort)) - .append(", ").append(mAuthType).append(", "); + .append(mEntryName) + .append(", ").append(mId) + .append(", ").append(mOperatorNumeric) + .append(", ").append(mApnName) + .append(", ").append(mProxyAddress) + .append(", ").append(UriToString(mMmsc)) + .append(", ").append(mMmsProxyAddress) + .append(", ").append(portToString(mMmsProxyPort)) + .append(", ").append(portToString(mProxyPort)) + .append(", ").append(mAuthType).append(", "); final String[] types = getApnTypesStringFromBitmask(mApnTypeBitmask).split(","); sb.append(TextUtils.join(" | ", types)); sb.append(", ").append(PROTOCOL_INT_MAP.get(mProtocol)); @@ -1022,31 +1022,31 @@ public class ApnSetting implements Parcelable { ApnSetting other = (ApnSetting) o; return mEntryName.equals(other.mEntryName) - && Objects.equals(mId, other.mId) - && Objects.equals(mOperatorNumeric, other.mOperatorNumeric) - && Objects.equals(mApnName, other.mApnName) - && Objects.equals(mProxyAddress, other.mProxyAddress) - && Objects.equals(mMmsc, other.mMmsc) - && Objects.equals(mMmsProxyAddress, other.mMmsProxyAddress) - && Objects.equals(mMmsProxyPort, other.mMmsProxyPort) - && Objects.equals(mProxyPort, other.mProxyPort) - && Objects.equals(mUser, other.mUser) - && Objects.equals(mPassword, other.mPassword) - && Objects.equals(mAuthType, other.mAuthType) - && Objects.equals(mApnTypeBitmask, other.mApnTypeBitmask) - && Objects.equals(mProtocol, other.mProtocol) - && Objects.equals(mRoamingProtocol, other.mRoamingProtocol) - && Objects.equals(mCarrierEnabled, other.mCarrierEnabled) - && Objects.equals(mProfileId, other.mProfileId) - && Objects.equals(mModemCognitive, other.mModemCognitive) - && Objects.equals(mMaxConns, other.mMaxConns) - && Objects.equals(mWaitTime, other.mWaitTime) - && Objects.equals(mMaxConnsTime, other.mMaxConnsTime) - && Objects.equals(mMtu, other.mMtu) - && Objects.equals(mMvnoType, other.mMvnoType) - && Objects.equals(mMvnoMatchData, other.mMvnoMatchData) - && Objects.equals(mNetworkTypeBitmask, other.mNetworkTypeBitmask) - && Objects.equals(mApnSetId, other.mApnSetId); + && Objects.equals(mId, other.mId) + && Objects.equals(mOperatorNumeric, other.mOperatorNumeric) + && Objects.equals(mApnName, other.mApnName) + && Objects.equals(mProxyAddress, other.mProxyAddress) + && Objects.equals(mMmsc, other.mMmsc) + && Objects.equals(mMmsProxyAddress, other.mMmsProxyAddress) + && Objects.equals(mMmsProxyPort, other.mMmsProxyPort) + && Objects.equals(mProxyPort,other.mProxyPort) + && Objects.equals(mUser, other.mUser) + && Objects.equals(mPassword, other.mPassword) + && Objects.equals(mAuthType, other.mAuthType) + && Objects.equals(mApnTypeBitmask, other.mApnTypeBitmask) + && Objects.equals(mProtocol, other.mProtocol) + && Objects.equals(mRoamingProtocol, other.mRoamingProtocol) + && Objects.equals(mCarrierEnabled, other.mCarrierEnabled) + && Objects.equals(mProfileId, other.mProfileId) + && Objects.equals(mModemCognitive, other.mModemCognitive) + && Objects.equals(mMaxConns, other.mMaxConns) + && Objects.equals(mWaitTime, other.mWaitTime) + && Objects.equals(mMaxConnsTime, other.mMaxConnsTime) + && Objects.equals(mMtu, other.mMtu) + && Objects.equals(mMvnoType, other.mMvnoType) + && Objects.equals(mMvnoMatchData, other.mMvnoMatchData) + && Objects.equals(mNetworkTypeBitmask, other.mNetworkTypeBitmask) + && Objects.equals(mApnSetId, other.mApnSetId); } /** @@ -1069,29 +1069,29 @@ public class ApnSetting implements Parcelable { ApnSetting other = (ApnSetting) o; return mEntryName.equals(other.mEntryName) - && Objects.equals(mOperatorNumeric, other.mOperatorNumeric) - && Objects.equals(mApnName, other.mApnName) - && Objects.equals(mProxyAddress, other.mProxyAddress) - && Objects.equals(mMmsc, other.mMmsc) - && Objects.equals(mMmsProxyAddress, other.mMmsProxyAddress) - && Objects.equals(mMmsProxyPort, other.mMmsProxyPort) - && Objects.equals(mProxyPort, other.mProxyPort) - && Objects.equals(mUser, other.mUser) - && Objects.equals(mPassword, other.mPassword) - && Objects.equals(mAuthType, other.mAuthType) - && Objects.equals(mApnTypeBitmask, other.mApnTypeBitmask) - && (isDataRoaming || Objects.equals(mProtocol, other.mProtocol)) - && (!isDataRoaming || Objects.equals(mRoamingProtocol, other.mRoamingProtocol)) - && Objects.equals(mCarrierEnabled, other.mCarrierEnabled) - && Objects.equals(mProfileId, other.mProfileId) - && Objects.equals(mModemCognitive, other.mModemCognitive) - && Objects.equals(mMaxConns, other.mMaxConns) - && Objects.equals(mWaitTime, other.mWaitTime) - && Objects.equals(mMaxConnsTime, other.mMaxConnsTime) - && Objects.equals(mMtu, other.mMtu) - && Objects.equals(mMvnoType, other.mMvnoType) - && Objects.equals(mMvnoMatchData, other.mMvnoMatchData) - && Objects.equals(mApnSetId, other.mApnSetId); + && Objects.equals(mOperatorNumeric, other.mOperatorNumeric) + && Objects.equals(mApnName, other.mApnName) + && Objects.equals(mProxyAddress, other.mProxyAddress) + && Objects.equals(mMmsc, other.mMmsc) + && Objects.equals(mMmsProxyAddress, other.mMmsProxyAddress) + && Objects.equals(mMmsProxyPort, other.mMmsProxyPort) + && Objects.equals(mProxyPort, other.mProxyPort) + && Objects.equals(mUser, other.mUser) + && Objects.equals(mPassword, other.mPassword) + && Objects.equals(mAuthType, other.mAuthType) + && Objects.equals(mApnTypeBitmask, other.mApnTypeBitmask) + && (isDataRoaming || Objects.equals(mProtocol,other.mProtocol)) + && (!isDataRoaming || Objects.equals(mRoamingProtocol, other.mRoamingProtocol)) + && Objects.equals(mCarrierEnabled, other.mCarrierEnabled) + && Objects.equals(mProfileId, other.mProfileId) + && Objects.equals(mModemCognitive, other.mModemCognitive) + && Objects.equals(mMaxConns, other.mMaxConns) + && Objects.equals(mWaitTime, other.mWaitTime) + && Objects.equals(mMaxConnsTime, other.mMaxConnsTime) + && Objects.equals(mMtu, other.mMtu) + && Objects.equals(mMvnoType, other.mMvnoType) + && Objects.equals(mMvnoMatchData, other.mMvnoMatchData) + && Objects.equals(mApnSetId, other.mApnSetId); } /** @@ -1103,22 +1103,22 @@ public class ApnSetting implements Parcelable { */ public boolean similar(ApnSetting other) { return (!this.canHandleType(TYPE_DUN) - && !other.canHandleType(TYPE_DUN) - && Objects.equals(this.mApnName, other.mApnName) - && !typeSameAny(this, other) - && xorEquals(this.mProxyAddress, other.mProxyAddress) - && xorEqualsInt(this.mProxyPort, other.mProxyPort) - && xorEquals(this.mProtocol, other.mProtocol) - && xorEquals(this.mRoamingProtocol, other.mRoamingProtocol) - && Objects.equals(this.mCarrierEnabled, other.mCarrierEnabled) - && Objects.equals(this.mProfileId, other.mProfileId) - && Objects.equals(this.mMvnoType, other.mMvnoType) - && Objects.equals(this.mMvnoMatchData, other.mMvnoMatchData) - && xorEquals(this.mMmsc, other.mMmsc) - && xorEquals(this.mMmsProxyAddress, other.mMmsProxyAddress) - && xorEqualsInt(this.mMmsProxyPort, other.mMmsProxyPort)) - && Objects.equals(this.mNetworkTypeBitmask, other.mNetworkTypeBitmask) - && Objects.equals(mApnSetId, other.mApnSetId); + && !other.canHandleType(TYPE_DUN) + && Objects.equals(this.mApnName, other.mApnName) + && !typeSameAny(this, other) + && xorEquals(this.mProxyAddress, other.mProxyAddress) + && xorEqualsInt(this.mProxyPort, other.mProxyPort) + && xorEquals(this.mProtocol, other.mProtocol) + && xorEquals(this.mRoamingProtocol, other.mRoamingProtocol) + && Objects.equals(this.mCarrierEnabled, other.mCarrierEnabled) + && Objects.equals(this.mProfileId, other.mProfileId) + && Objects.equals(this.mMvnoType, other.mMvnoType) + && Objects.equals(this.mMvnoMatchData, other.mMvnoMatchData) + && xorEquals(this.mMmsc, other.mMmsc) + && xorEquals(this.mMmsProxyAddress, other.mMmsProxyAddress) + && xorEqualsInt(this.mMmsProxyPort, other.mMmsProxyPort)) + && Objects.equals(this.mNetworkTypeBitmask, other.mNetworkTypeBitmask) + && Objects.equals(mApnSetId, other.mApnSetId); } // Equal or one is null. @@ -1343,13 +1343,13 @@ public class ApnSetting implements Parcelable { new Parcelable.Creator<ApnSetting>() { @Override public ApnSetting createFromParcel(Parcel in) { - return readFromParcel(in); - } + return readFromParcel(in); + } @Override public ApnSetting[] newArray(int size) { - return new ApnSetting[size]; - } + return new ApnSetting[size]; + } }; /** diff --git a/tests/ActivityTests/Android.mk b/tests/ActivityTests/Android.mk index 4c68c8bb40c2..94294f6b062a 100644 --- a/tests/ActivityTests/Android.mk +++ b/tests/ActivityTests/Android.mk @@ -10,9 +10,5 @@ LOCAL_MODULE_TAGS := tests LOCAL_CERTIFICATE := platform LOCAL_USE_AAPT2 := true -# Disable AAPT2 manifest checks to fix: -# frameworks/base/tests/ActivityTests/AndroidManifest.xml:42: error: unexpected element <preferred> found in <manifest><application><activity>. -# TODO(b/79755007): Remove when AAPT2 recognizes the manifest elements. -LOCAL_AAPT_FLAGS += --warn-manifest-validation include $(BUILD_PACKAGE) diff --git a/tools/aapt2/link/ManifestFixer.cpp b/tools/aapt2/link/ManifestFixer.cpp index ee4e70288994..7180a9918abe 100644 --- a/tools/aapt2/link/ManifestFixer.cpp +++ b/tools/aapt2/link/ManifestFixer.cpp @@ -252,6 +252,7 @@ bool ManifestFixer::BuildRules(xml::XmlActionExecutor* executor, xml::XmlNodeAction component_action; component_action.Action(RequiredNameIsJavaClassName); component_action["intent-filter"] = intent_filter_action; + component_action["preferred"] = intent_filter_action; component_action["meta-data"] = meta_data_action; // Manifest actions. @@ -346,6 +347,7 @@ bool ManifestFixer::BuildRules(xml::XmlActionExecutor* executor, manifest_action["uses-permission"]; manifest_action["uses-permission-sdk-23"]; manifest_action["permission"]; + manifest_action["permission"]["meta-data"] = meta_data_action; manifest_action["permission-tree"]; manifest_action["permission-group"]; manifest_action["uses-configuration"]; @@ -355,6 +357,8 @@ bool ManifestFixer::BuildRules(xml::XmlActionExecutor* executor, manifest_action["compatible-screens"]; manifest_action["compatible-screens"]["screen"]; manifest_action["supports-gl-texture"]; + manifest_action["restrict-update"]; + manifest_action["package-verifier"]; manifest_action["meta-data"] = meta_data_action; manifest_action["uses-split"].Action(RequiredNameIsJavaPackage); @@ -376,6 +380,7 @@ bool ManifestFixer::BuildRules(xml::XmlActionExecutor* executor, uses_static_library_action.Action(RequiredNameIsJavaPackage); uses_static_library_action.Action(RequiredAndroidAttribute("version")); uses_static_library_action.Action(RequiredAndroidAttribute("certDigest")); + uses_static_library_action["additional-certificate"]; if (options_.debug_mode) { application_action.Action([&](xml::Element* el) -> bool { @@ -399,6 +404,8 @@ bool ManifestFixer::BuildRules(xml::XmlActionExecutor* executor, application_action["provider"]["grant-uri-permission"]; application_action["provider"]["path-permission"]; + manifest_action["package"] = manifest_action; + return true; } diff --git a/wifi/tests/src/android/net/wifi/hotspot2/pps/HomeSpTest.java b/wifi/tests/src/android/net/wifi/hotspot2/pps/HomeSpTest.java index 5c9df6a0186c..c7993e308d17 100644 --- a/wifi/tests/src/android/net/wifi/hotspot2/pps/HomeSpTest.java +++ b/wifi/tests/src/android/net/wifi/hotspot2/pps/HomeSpTest.java @@ -189,8 +189,7 @@ public class HomeSpTest { Map<String, Long> homeNetworkIds = new HashMap<>(); byte[] rawSsidBytes = new byte[33]; Arrays.fill(rawSsidBytes, (byte) 'a'); - homeNetworkIds.put( - StringFactory.newStringFromBytes(rawSsidBytes, StandardCharsets.UTF_8), 0x1234L); + homeNetworkIds.put(new String(rawSsidBytes, StandardCharsets.UTF_8), 0x1234L); homeSp.setHomeNetworkIds(homeNetworkIds); assertFalse(homeSp.validate()); } |