From aa8749619f4c7a79354b23f34394823166031cc9 Mon Sep 17 00:00:00 2001 From: Amit Mahajan Date: Tue, 11 Jul 2017 11:58:07 -0700 Subject: [PATCH 001/398] Change return value of getTetherApnRequired() to a boolean. Test: Basic sanity - verified tethering for T-Mobile Bug: 63150712 Change-Id: I03ce7b6bcf4bbd9d0dfcd733141c0d20d9b3a790 --- telephony/java/android/telephony/TelephonyManager.java | 10 ++++------ .../com/android/internal/telephony/ITelephony.aidl | 9 ++++----- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 91f832b97ff..8b4443eab22 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -6274,14 +6274,12 @@ public class TelephonyManager { } /** - * Check TETHER_DUN_REQUIRED and TETHER_DUN_APN settings, net.tethering.noprovisioning - * SystemProperty to decide whether DUN APN is required for - * tethering. + * Check whether DUN APN is required for tethering. * - * @return 0: Not required. 1: required. 2: Not set. + * @return {@code true} if DUN APN is required for tethering. * @hide */ - public int getTetherApnRequired() { + public boolean getTetherApnRequired() { try { ITelephony telephony = getITelephony(); if (telephony != null) @@ -6291,7 +6289,7 @@ public class TelephonyManager { } catch (NullPointerException ex) { Rlog.e(TAG, "hasMatchedTetherApnSetting NPE", ex); } - return 2; + return false; } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 2e79c616284..ad1b25d71eb 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -681,13 +681,12 @@ interface ITelephony { int getPreferredNetworkType(int subId); /** - * Check TETHER_DUN_REQUIRED and TETHER_DUN_APN settings, net.tethering.noprovisioning - * SystemProperty to decide whether DUN APN is required for - * tethering. + * Check whether DUN APN is required for tethering. * - * @return 0: Not required. 1: required. 2: Not set. + * @return {@code true} if DUN APN is required for tethering. + * @hide */ - int getTetherApnRequired(); + boolean getTetherApnRequired(); /** * Enables framework IMS and triggers IMS Registration. -- GitLab From 14a8b1f326087e2ea4156dbb7c7823c95409ee74 Mon Sep 17 00:00:00 2001 From: yusukes Date: Mon, 23 Jul 2018 17:34:42 -0700 Subject: [PATCH 002/398] Do not call into vold when the device is not block encrypted Previously the function checked if the device used FBE and returned early when it did. This CL changes the function to check if the devices uses block encryption and return early when it does not. This is just to make the check more straightforward, and shouldn't change existing devices' behavior. Bug: 111653208 Test: manual Change-Id: If61cb48ab2650d8d4c53d02622d550e190b5eb15 (cherry picked from commit 909d4c3510a9073bc332c0ce225c4b14a7fd2b38) --- .../java/com/android/server/StorageManagerService.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java index 2a806447d60..9f8eeb3a067 100644 --- a/services/core/java/com/android/server/StorageManagerService.java +++ b/services/core/java/com/android/server/StorageManagerService.java @@ -2624,8 +2624,8 @@ class StorageManagerService extends IStorageManager.Stub mContext.enforceCallingOrSelfPermission(Manifest.permission.CRYPT_KEEPER, "no permission to access the crypt keeper"); - if (StorageManager.isFileEncryptedNativeOnly()) { - // Not supported on FBE devices + if (!StorageManager.isBlockEncrypted()) { + // Only supported on FDE devices return; } @@ -2648,8 +2648,8 @@ class StorageManagerService extends IStorageManager.Stub mContext.enforceCallingOrSelfPermission(Manifest.permission.CRYPT_KEEPER, "no permission to access the crypt keeper"); - if (StorageManager.isFileEncryptedNativeOnly()) { - // Not supported on FBE devices + if (!StorageManager.isBlockEncrypted()) { + // Only supported on FDE devices return null; } -- GitLab From afea7de9b95d81c4c2be4343fdf0e3bf8af06c3e Mon Sep 17 00:00:00 2001 From: Shi Yuanjie Date: Thu, 19 Jul 2018 20:30:10 +0900 Subject: [PATCH 003/398] Fix to hide phone number printed in the log The ConnectionRequest and ImsConferenceState fields may include phone numbers and it is output to the log. Since PII should not be printed in the log, mask it using Log.pii(). Bug: 111812270 Test: manual - Checked that phone number is not printed in the log when receive an incoming call and make an IMS conference call. Change-Id: I462ae7f923128a2d06d0415bcde0c779e932139f --- .../android/telecom/ConnectionRequest.java | 26 ++++++++++++++++++- .../telephony/ims/ImsConferenceState.java | 15 ++++++----- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/telecomm/java/android/telecom/ConnectionRequest.java b/telecomm/java/android/telecom/ConnectionRequest.java index b6e6b0ed827..d69d2cd756d 100644 --- a/telecomm/java/android/telecom/ConnectionRequest.java +++ b/telecomm/java/android/telecom/ConnectionRequest.java @@ -337,7 +337,31 @@ public final class ConnectionRequest implements Parcelable { mAddress == null ? Uri.EMPTY : Connection.toLogSafePhoneNumber(mAddress.toString()), - mExtras == null ? "" : mExtras); + bundleToString(mExtras)); + } + + private static String bundleToString(Bundle extras){ + if (extras == null) { + return ""; + } + StringBuilder sb = new StringBuilder(); + sb.append("Bundle["); + for (String key : extras.keySet()) { + sb.append(key); + sb.append("="); + switch (key) { + case TelecomManager.EXTRA_INCOMING_CALL_ADDRESS: + case TelecomManager.EXTRA_UNKNOWN_CALL_HANDLE: + sb.append(Log.pii(extras.get(key))); + break; + default: + sb.append(extras.get(key)); + break; + } + sb.append(", "); + } + sb.append("]"); + return sb.toString(); } public static final Creator CREATOR = new Creator () { diff --git a/telephony/java/android/telephony/ims/ImsConferenceState.java b/telephony/java/android/telephony/ims/ImsConferenceState.java index 66d2f8d929d..8af8cffcd87 100644 --- a/telephony/java/android/telephony/ims/ImsConferenceState.java +++ b/telephony/java/android/telephony/ims/ImsConferenceState.java @@ -16,17 +16,18 @@ package android.telephony.ims; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map.Entry; -import java.util.Set; - import android.annotation.SystemApi; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.telecom.Call; import android.telecom.Connection; +import android.telecom.Log; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map.Entry; +import java.util.Set; /** * Provides the conference information (defined in RFC 4575) for IMS conference call. @@ -189,7 +190,7 @@ public final class ImsConferenceState implements Parcelable { sb.append("<"); while (iterator.hasNext()) { Entry entry = iterator.next(); - sb.append(entry.getKey()); + sb.append(Log.pii(entry.getKey())); sb.append(": "); Bundle participantData = entry.getValue(); @@ -197,7 +198,7 @@ public final class ImsConferenceState implements Parcelable { sb.append(key); sb.append("="); if (ENDPOINT.equals(key) || USER.equals(key)) { - sb.append(android.telecom.Log.pii(participantData.get(key))); + sb.append(Log.pii(participantData.get(key))); } else { sb.append(participantData.get(key)); } -- GitLab From 4a50a8ec06cc3ebe4cf6fdc45bccb28e3fc66c38 Mon Sep 17 00:00:00 2001 From: Yong Shi Date: Mon, 21 May 2018 15:53:02 +0800 Subject: [PATCH 004/398] Show mobile icons with left-to-right in order of slot index Icon list of status bar is displayed as first items go to the right of second items. But mobile icon has order of slot index and these must be shown with left-to-right([Slot1][Slot2]..). Reverse the sort order in icon list beforehand. Test: manual - Checked that the SIM-slot1 icon is shown on the left side of SIM-slot2. Test: auto - Passed StatusBarIconListTest. Bug: 123931542 Change-Id: I2d9fcd63e9ef05f96ba4a17de78bb834b71729e8 --- .../phone/StatusBarIconControllerImpl.java | 7 ++++++- .../statusbar/phone/StatusBarIconList.java | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java index 24a58966560..72da591e061 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java @@ -43,6 +43,7 @@ import com.android.systemui.tuner.TunerService.Tunable; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import static com.android.systemui.statusbar.phone.StatusBarIconController.TAG_PRIMARY; @@ -121,7 +122,7 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu // Remove all the icons. for (int i = currentSlots.size() - 1; i >= 0; i--) { Slot s = currentSlots.get(i); - slotsToReAdd.put(s, s.getHolderListInViewOrder()); + slotsToReAdd.put(s, s.getHolderList()); removeAllIconsForSlot(s.getName()); } @@ -200,6 +201,10 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu Slot mobileSlot = getSlot(slot); int slotIndex = getSlotIndex(slot); + // Reverse the sort order to show icons with left to right([Slot1][Slot2]..). + // StatusBarIconList has UI design that first items go to the right of second items. + Collections.reverse(iconStates); + for (MobileIconState state : iconStates) { StatusBarIconHolder holder = mobileSlot.getHolderForTag(state.subId); if (holder == null) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconList.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconList.java index b7e1cfb0097..fc4122580c2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconList.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconList.java @@ -249,6 +249,25 @@ public class StatusBarIconList { return holders; } + /** + * Build a list of the {@link StatusBarIconHolder}s in the same order. + * This provides a safe list that can be iterated and inserted into its group. + * + * @return all holders contained here + */ + public List getHolderList() { + ArrayList holders = new ArrayList<>(); + if (mHolder != null) { + holders.add(mHolder); + } + + if (mSubSlots != null) { + holders.addAll(mSubSlots); + } + + return holders; + } + @Override public String toString() { return String.format("(%s) %s", mName, subSlotsString()); -- GitLab From 803f4194510a7600f129ea79fd415a4defe0778e Mon Sep 17 00:00:00 2001 From: Satoshi Sanno Date: Fri, 8 Feb 2019 18:54:23 +0900 Subject: [PATCH 005/398] Fix that the update to v1 signed version fails if apk verity is enabled Symptom: To update APK Signature Scheme v1 signed system priv-app to new v1 signed version fails if apk verity is enabled. Root cause: The package manager gets the verity root hash from apk for apk verity. But, the getting prosess does not consider v1 signed apk. The getting prosess fails if the apk is v1 signed. It causes the update failure. Solution: Always skip apk verity if the apk is v1 signed. Because v1 signed apk always does not have the verity root hash, and apk verity has been skipped in case of that the apk is v2 or v3 signed and the apk does not have the verity root hash. Bug: 124354537 Change-Id: Ieb19ed9a3277bfad09dc67a1abf1d9039c44709f --- core/java/android/util/apk/ApkSignatureVerifier.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/java/android/util/apk/ApkSignatureVerifier.java b/core/java/android/util/apk/ApkSignatureVerifier.java index de9f55b0920..544cc1c76d4 100644 --- a/core/java/android/util/apk/ApkSignatureVerifier.java +++ b/core/java/android/util/apk/ApkSignatureVerifier.java @@ -397,15 +397,18 @@ public class ApkSignatureVerifier { /** * @return the verity root hash in the Signing Block. */ - public static byte[] getVerityRootHash(String apkPath) - throws IOException, SignatureNotFoundException, SecurityException { + public static byte[] getVerityRootHash(String apkPath) throws IOException, SecurityException { // first try v3 try { return ApkSignatureSchemeV3Verifier.getVerityRootHash(apkPath); } catch (SignatureNotFoundException e) { // try older version } - return ApkSignatureSchemeV2Verifier.getVerityRootHash(apkPath); + try { + return ApkSignatureSchemeV2Verifier.getVerityRootHash(apkPath); + } catch (SignatureNotFoundException e) { + return null; + } } /** -- GitLab From 6132b0210b72a8d01cb07026bbf6dd512d95b8cc Mon Sep 17 00:00:00 2001 From: Yin-Chia Yeh Date: Thu, 14 Feb 2019 16:40:20 -0800 Subject: [PATCH 006/398] ImageWriter: create a thread for buffer detaching Calling detachNextBuffer while producer/consumer sits in the same process will cause a deadlock. Creating a thread shared by all alive ImageWriter instances to detachBuffers. Test: new CTS tests using TextureView + ImageWriter Bug: 122740799 Change-Id: I6231c75b93aa862449831a050b376f978b459bed --- media/jni/android_media_ImageWriter.cpp | 131 ++++++++++++++++++++++-- 1 file changed, 122 insertions(+), 9 deletions(-) diff --git a/media/jni/android_media_ImageWriter.cpp b/media/jni/android_media_ImageWriter.cpp index 031e373241c..cfcba76d3af 100644 --- a/media/jni/android_media_ImageWriter.cpp +++ b/media/jni/android_media_ImageWriter.cpp @@ -18,8 +18,11 @@ #define LOG_TAG "ImageWriter_JNI" #include "android_media_Utils.h" +#include #include +#include #include +#include #include #include @@ -34,6 +37,8 @@ #include #include +#include + #define IMAGE_BUFFER_JNI_ID "mNativeBuffer" #define IMAGE_FORMAT_UNKNOWN 0 // This is the same value as ImageFormat#UNKNOWN. // ---------------------------------------------------------------------------- @@ -90,14 +95,124 @@ private: int mFormat; int mWidth; int mHeight; + + // Class for a shared thread used to detach buffers from buffer queues + // to discard buffers after consumers are done using them. + // This is needed because detaching buffers in onBufferReleased callback + // can lead to deadlock when consumer/producer are on the same process. + class BufferDetacher { + public: + // Called by JNIImageWriterContext ctor. Will start the thread for first ref. + void addRef(); + // Called by JNIImageWriterContext dtor. Will stop the thread after ref goes to 0. + void removeRef(); + // Called by onBufferReleased to signal this thread to detach a buffer + void detach(wp); + + private: + + class DetachThread : public Thread { + public: + DetachThread() : Thread(/*canCallJava*/false) {}; + + void detach(wp); + + virtual void requestExit() override; + + private: + virtual bool threadLoop() override; + + Mutex mLock; + Condition mCondition; + std::deque> mQueue; + + static const nsecs_t kWaitDuration = 20000000; // 20 ms + }; + sp mThread; + + Mutex mLock; + int mRefCount = 0; + }; + + static BufferDetacher sBufferDetacher; }; +JNIImageWriterContext::BufferDetacher JNIImageWriterContext::sBufferDetacher; + +void JNIImageWriterContext::BufferDetacher::addRef() { + Mutex::Autolock l(mLock); + mRefCount++; + if (mRefCount == 1) { + mThread = new DetachThread(); + mThread->run("BufDtchThrd"); + } +} + +void JNIImageWriterContext::BufferDetacher::removeRef() { + Mutex::Autolock l(mLock); + mRefCount--; + if (mRefCount == 0) { + mThread->requestExit(); + mThread->join(); + mThread.clear(); + } +} + +void JNIImageWriterContext::BufferDetacher::detach(wp bq) { + Mutex::Autolock l(mLock); + if (mThread == nullptr) { + ALOGE("%s: buffer detach thread is gone!", __FUNCTION__); + return; + } + mThread->detach(bq); +} + +void JNIImageWriterContext::BufferDetacher::DetachThread::detach(wp bq) { + Mutex::Autolock l(mLock); + mQueue.push_back(bq); + mCondition.signal(); +} + +void JNIImageWriterContext::BufferDetacher::DetachThread::requestExit() { + Thread::requestExit(); + { + Mutex::Autolock l(mLock); + mQueue.clear(); + } + mCondition.signal(); +} + +bool JNIImageWriterContext::BufferDetacher::DetachThread::threadLoop() { + Mutex::Autolock l(mLock); + mCondition.waitRelative(mLock, kWaitDuration); + + while (!mQueue.empty()) { + if (exitPending()) { + return false; + } + + wp wbq = mQueue.front(); + mQueue.pop_front(); + sp bq = wbq.promote(); + if (bq != nullptr) { + sp fence; + sp buffer; + ALOGV("%s: One buffer is detached", __FUNCTION__); + mLock.unlock(); + bq->detachNextBuffer(&buffer, &fence); + mLock.lock(); + } + } + return !exitPending(); +} + JNIImageWriterContext::JNIImageWriterContext(JNIEnv* env, jobject weakThiz, jclass clazz) : - mWeakThiz(env->NewGlobalRef(weakThiz)), - mClazz((jclass)env->NewGlobalRef(clazz)), - mFormat(0), - mWidth(-1), - mHeight(-1) { + mWeakThiz(env->NewGlobalRef(weakThiz)), + mClazz((jclass)env->NewGlobalRef(clazz)), + mFormat(0), + mWidth(-1), + mHeight(-1) { + sBufferDetacher.addRef(); } JNIImageWriterContext::~JNIImageWriterContext() { @@ -115,6 +230,7 @@ JNIImageWriterContext::~JNIImageWriterContext() { } mProducer.clear(); + sBufferDetacher.removeRef(); } JNIEnv* JNIImageWriterContext::getJNIEnv(bool* needsDetach) { @@ -153,10 +269,7 @@ void JNIImageWriterContext::onBufferReleased() { // need let this callback give a BufferItem, then only detach if it was attached to this // Writer. Do the detach unconditionally for opaque format now. see b/19977520 if (mFormat == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) { - sp fence; - sp buffer; - ALOGV("%s: One buffer is detached", __FUNCTION__); - mProducer->detachNextBuffer(&buffer, &fence); + sBufferDetacher.detach(mProducer); } env->CallStaticVoidMethod(mClazz, gImageWriterClassInfo.postEventFromNative, mWeakThiz); -- GitLab From 03e67da0fbcea54de02445e3c1bc2fe00113d705 Mon Sep 17 00:00:00 2001 From: Jackal Guo Date: Thu, 14 Feb 2019 15:27:25 +0800 Subject: [PATCH 007/398] Add Intent and permission for a11y service toggle screen Add an Intent to open individual a11y service toggle screen, and this Intent also needs to be protected by a dedicated permission. Bug: 123693167 Test: atest PermissionPolicyTest Change-Id: I058ab17b7f5819aa95205ae72e61af17d04b5df1 --- api/system-current.txt | 2 ++ core/java/android/provider/Settings.java | 16 ++++++++++++++++ core/res/AndroidManifest.xml | 7 +++++++ 3 files changed, 25 insertions(+) diff --git a/api/system-current.txt b/api/system-current.txt index fb2b9e1e05f..fe9233613af 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -120,6 +120,7 @@ package android { field public static final String NOTIFY_TV_INPUTS = "android.permission.NOTIFY_TV_INPUTS"; field public static final String OBSERVE_APP_USAGE = "android.permission.OBSERVE_APP_USAGE"; field public static final String OBSERVE_ROLE_HOLDERS = "android.permission.OBSERVE_ROLE_HOLDERS"; + field public static final String OPEN_ACCESSIBILITY_DETAILS_SETTINGS = "android.permission.OPEN_ACCESSIBILITY_DETAILS_SETTINGS"; field public static final String OVERRIDE_WIFI_CONFIG = "android.permission.OVERRIDE_WIFI_CONFIG"; field public static final String PACKAGE_VERIFICATION_AGENT = "android.permission.PACKAGE_VERIFICATION_AGENT"; field public static final String PACKET_KEEPALIVE_OFFLOAD = "android.permission.PACKET_KEEPALIVE_OFFLOAD"; @@ -5954,6 +5955,7 @@ package android.provider { } public final class Settings { + field public static final String ACTION_ACCESSIBILITY_DETAILS_SETTINGS = "android.settings.ACCESSIBILITY_DETAILS_SETTINGS"; field public static final String ACTION_ENTERPRISE_PRIVACY_SETTINGS = "android.settings.ENTERPRISE_PRIVACY_SETTINGS"; field public static final String ACTION_LOCATION_CONTROLLER_EXTRA_PACKAGE_SETTINGS = "android.settings.LOCATION_CONTROLLER_EXTRA_PACKAGE_SETTINGS"; field public static final String ACTION_REQUEST_ENABLE_CONTENT_CAPTURE = "android.settings.REQUEST_ENABLE_CONTENT_CAPTURE"; diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index d925d7ee267..74172d7353d 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -307,6 +307,22 @@ public final class Settings { public static final String ACTION_ACCESSIBILITY_SETTINGS = "android.settings.ACCESSIBILITY_SETTINGS"; + /** + * Activity Action: Show detail settings of a particular accessibility service. + *

+ * In some cases, a matching Activity may not exist, so ensure you safeguard against this. + *

+ * Input: {@link Intent#EXTRA_COMPONENT_NAME} must specify the accessibility service component + * name to be shown. + *

+ * Output: Nothing. + * @hide + **/ + @SystemApi + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_ACCESSIBILITY_DETAILS_SETTINGS = + "android.settings.ACCESSIBILITY_DETAILS_SETTINGS"; + /** * Activity Action: Show settings to control access to usage information. *

diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 5b74d90608f..57d3c61b50e 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -2936,6 +2936,13 @@ + + + - #1f000000 + @color/navigation_bar_divider_device_default_settings @android:color/white true -- GitLab From 90882258ed7c08dd652823fa68f7f8c2170ba3e0 Mon Sep 17 00:00:00 2001 From: Chiachang Wang Date: Wed, 27 Feb 2019 17:14:50 +0800 Subject: [PATCH 029/398] Fix broken javadoc links Bug: 123683994 Test: Verify with javadoc Change-Id: I4b1b936e3cf86104ace5fcb6829778710801f2d5 --- core/java/android/net/ConnectivityManager.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index 92b30a440d6..24a907bd929 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -3668,7 +3668,8 @@ public class ConnectivityManager { /** * Registers to receive notifications about all networks which satisfy the given * {@link NetworkRequest}. The callbacks will continue to be called until - * either the application exits or link #unregisterNetworkCallback(NetworkCallback)} is called. + * either the application exits or {@link #unregisterNetworkCallback(NetworkCallback)} is + * called. * * @param request {@link NetworkRequest} describing this request. * @param networkCallback The {@link NetworkCallback} that the system will call as suitable @@ -3684,7 +3685,8 @@ public class ConnectivityManager { /** * Registers to receive notifications about all networks which satisfy the given * {@link NetworkRequest}. The callbacks will continue to be called until - * either the application exits or link #unregisterNetworkCallback(NetworkCallback)} is called. + * either the application exits or {@link #unregisterNetworkCallback(NetworkCallback)} is + * called. * * @param request {@link NetworkRequest} describing this request. * @param networkCallback The {@link NetworkCallback} that the system will call as suitable -- GitLab From 94229b3103fff3b85d6774fffdf19f8d149ac217 Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Wed, 20 Feb 2019 21:34:01 +0900 Subject: [PATCH 030/398] Ensure handleUpdateLinkProperties runs on the CS handler thread. In its own change for ease of rollbacks due to the risk of possibly crashing existing codepaths. Bug: 65674744 Test: atest FrameworksNetTests Test: builds, boots. Wifi, cell data, private DNS work Change-Id: I2c0acc1c7b8367803f17b4a12c1df0fdfbc29691 --- services/core/java/com/android/server/ConnectivityService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 6efa5c10905..9806ca0fb92 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -5558,6 +5558,8 @@ public class ConnectivityService extends IConnectivityManager.Stub } public void handleUpdateLinkProperties(NetworkAgentInfo nai, LinkProperties newLp) { + ensureRunningOnConnectivityServiceThread(); + if (getNetworkAgentInfoForNetId(nai.network.netId) != nai) { // Ignore updates for disconnected networks return; -- GitLab From 479a296d6d3e0058e78791f1d272376b9a1032e0 Mon Sep 17 00:00:00 2001 From: Richard Uhler Date: Wed, 27 Feb 2019 10:59:10 +0000 Subject: [PATCH 031/398] Rename RollbackData.inProgress to restoreUserDataInProgress. Which is much more explicit about what is in progress. Also, persist restoreUserDataInProgress in preparation for properly handling that flag for staged installs. Bug: 124044231 Test: atest RollbackTest Change-Id: Icbb67c3c0dbba7ee74597d14f7de4a53cf884608 --- .../java/com/android/server/rollback/RollbackData.java | 8 ++++---- .../server/rollback/RollbackManagerServiceImpl.java | 8 ++++---- .../java/com/android/server/rollback/RollbackStore.java | 2 ++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/services/core/java/com/android/server/rollback/RollbackData.java b/services/core/java/com/android/server/rollback/RollbackData.java index fcd5297f136..bad3963f993 100644 --- a/services/core/java/com/android/server/rollback/RollbackData.java +++ b/services/core/java/com/android/server/rollback/RollbackData.java @@ -69,12 +69,12 @@ class RollbackData { public int apkSessionId = -1; /** - * Whether this Rollback is currently in progress. This field is true from the point - * we commit a {@code PackageInstaller} session containing these packages to the point the - * {@code PackageInstaller} calls into the {@code onFinished} callback. + * True if we are expecting the package manager to call restoreUserData + * for this rollback because it has just been committed but the rollback + * has not yet been fully applied. */ // NOTE: All accesses to this field are from the RollbackManager handler thread. - public boolean inProgress = false; + public boolean restoreUserDataInProgress = false; RollbackData(int rollbackId, File backupDir, int stagedSessionId, boolean isAvailable) { this.rollbackId = rollbackId; diff --git a/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java b/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java index 88a5fb48ada..767f56a8a3b 100644 --- a/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java +++ b/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java @@ -335,7 +335,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { return; } - if (data.inProgress) { + if (data.restoreUserDataInProgress) { sendFailure(statusReceiver, RollbackManager.STATUS_FAILURE_ROLLBACK_UNAVAILABLE, "Rollback for package is already in progress."); return; @@ -441,7 +441,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { getHandler().post(() -> { // We've now completed the rollback, so we mark it as no longer in // progress. - data.inProgress = false; + data.restoreUserDataInProgress = false; int status = result.getIntExtra(PackageInstaller.EXTRA_STATUS, PackageInstaller.STATUS_FAILURE); @@ -469,7 +469,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { } ); - data.inProgress = true; + data.restoreUserDataInProgress = true; parentSession.commit(receiver.getIntentSender()); } catch (IOException e) { Log.e(TAG, "Rollback failed", e); @@ -1044,7 +1044,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { return; } - if (!rollbackData.inProgress) { + if (!rollbackData.restoreUserDataInProgress) { Log.e(TAG, "Request to restore userData for: " + packageName + ", but no rollback in progress."); return; diff --git a/services/core/java/com/android/server/rollback/RollbackStore.java b/services/core/java/com/android/server/rollback/RollbackStore.java index bb4e89eca5d..99e102a2edb 100644 --- a/services/core/java/com/android/server/rollback/RollbackStore.java +++ b/services/core/java/com/android/server/rollback/RollbackStore.java @@ -274,6 +274,7 @@ class RollbackStore { dataJson.put("stagedSessionId", data.stagedSessionId); dataJson.put("isAvailable", data.isAvailable); dataJson.put("apkSessionId", data.apkSessionId); + dataJson.put("restoreUserDataInProgress", data.restoreUserDataInProgress); PrintWriter pw = new PrintWriter(new File(data.backupDir, "rollback.json")); pw.println(dataJson.toString()); @@ -338,6 +339,7 @@ class RollbackStore { data.packages.addAll(packageRollbackInfosFromJson(dataJson.getJSONArray("packages"))); data.timestamp = Instant.parse(dataJson.getString("timestamp")); data.apkSessionId = dataJson.getInt("apkSessionId"); + data.restoreUserDataInProgress = dataJson.getBoolean("restoreUserDataInProgress"); return data; } catch (JSONException | DateTimeParseException e) { throw new IOException(e); -- GitLab From f91d50b6200eb080c1b2cd63d13ae2c926e6d572 Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Thu, 21 Feb 2019 14:32:46 -0800 Subject: [PATCH 032/398] Introduce playback capture application manifest flag Allow apps to opt-out of their playback beeing recorded with an application wide out-out. Previously an application had to opt-out on each of its audio tracks. Application targeting an SDK < Q are considered opt-out by default. Application targeting an SDK >= Q are considered opt-in by default. Test: adb shell audiorecorder --target /data/file1.raw & adb shell am start -a android.intent.action.VIEW -d file:///system/media/audio/ringtones/Lollipop.ogg -t audio/ogg adb dumpsys media.audio_policy # check playback is *not* recorded # change packages/apps/Music manifest to allowPlaybackCapture=true adb install out/target/product/walleye/system/product/app/Music/Music.apk adb shell am start -a android.intent.action.VIEW -d file:///system/media/audio/ringtones/Lollipop.ogg -t audio/ogg adb dumpsys media.audio_policy # check playback is recorded kill %1 adb pull /data/file1.raw && sox -r 48000 -e signed -b 16 -c 2 file1.raw file.wav&& audacity file.wav # check that the audio file contains first silence then the ringtone after the manifest flag was added Bug: 111453086 Change-Id: Ie617b15f481a7f148b6e9fc9d64e61acaa5ce71d Signed-off-by: Kevin Rocard --- api/current.txt | 1 + .../android/content/pm/ApplicationInfo.java | 24 ++++++++++++++++++- .../android/content/pm/PackageParser.java | 6 +++++ core/res/res/values/attrs_manifest.xml | 3 +++ core/res/res/values/public.xml | 1 + .../AudioPlaybackCaptureConfiguration.java | 2 +- .../java/com/android/server/pm/Settings.java | 1 + 7 files changed, 36 insertions(+), 2 deletions(-) diff --git a/api/current.txt b/api/current.txt index 7e0156ff0bd..f9b11daf4de 100644 --- a/api/current.txt +++ b/api/current.txt @@ -287,6 +287,7 @@ package android { field public static final int alertDialogTheme = 16843529; // 0x1010309 field public static final int alignmentMode = 16843642; // 0x101037a field public static final int allContactsName = 16843468; // 0x10102cc + field public static final int allowAudioPlaybackCapture = 16844199; // 0x10105a7 field public static final int allowBackup = 16843392; // 0x1010280 field public static final int allowClearUserData = 16842757; // 0x1010005 field public static final int allowEmbedded = 16843765; // 0x10103f5 diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java index 6c6fcb2ea55..dad1a1a22fb 100644 --- a/core/java/android/content/pm/ApplicationInfo.java +++ b/core/java/android/content/pm/ApplicationInfo.java @@ -662,6 +662,14 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { */ public static final int PRIVATE_FLAG_ALLOW_CLEAR_USER_DATA_ON_FAILED_RESTORE = 1 << 26; + /** + * Value for {@link #privateFlags}: true if the application allows its audio playback + * to be captured by other apps. + * + * @hide + */ + public static final int PRIVATE_FLAG_ALLOW_AUDIO_PLAYBACK_CAPTURE = 1 << 27; + /** @hide */ @IntDef(flag = true, prefix = { "PRIVATE_FLAG_" }, value = { PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE, @@ -688,7 +696,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { PRIVATE_FLAG_VENDOR, PRIVATE_FLAG_VIRTUAL_PRELOAD, PRIVATE_FLAG_HAS_FRAGILE_USER_DATA, - PRIVATE_FLAG_ALLOW_CLEAR_USER_DATA_ON_FAILED_RESTORE + PRIVATE_FLAG_ALLOW_CLEAR_USER_DATA_ON_FAILED_RESTORE, + PRIVATE_FLAG_ALLOW_AUDIO_PLAYBACK_CAPTURE }) @Retention(RetentionPolicy.SOURCE) public @interface ApplicationInfoPrivateFlags {} @@ -1342,6 +1351,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { } pw.println(prefix + "HiddenApiEnforcementPolicy=" + getHiddenApiEnforcementPolicy()); pw.println(prefix + "usesNonSdkApi=" + usesNonSdkApi()); + pw.println(prefix + "allowsPlaybackCapture=" + + (isAudioPlaybackCaptureAllowed() ? "true" : "false")); } super.dumpBack(pw, prefix); } @@ -1790,6 +1801,17 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { return (privateFlags & PRIVATE_FLAG_HAS_FRAGILE_USER_DATA) != 0; } + /** + * Whether an app allows its playback audio to be captured by other apps. + * + * @return {@code true} if the app indicates that its audio can be captured by other apps. + * + * @hide + */ + public boolean isAudioPlaybackCaptureAllowed() { + return (privateFlags & PRIVATE_FLAG_ALLOW_AUDIO_PLAYBACK_CAPTURE) != 0; + } + private boolean isAllowedToUseHiddenApis() { if (isSignedWithPlatformKey()) { return true; diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index d7ca757d802..5bd047fcbfb 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -3753,6 +3753,12 @@ public class PackageParser { ai.privateFlags |= ApplicationInfo.PRIVATE_FLAG_ALLOW_CLEAR_USER_DATA_ON_FAILED_RESTORE; } + if (sa.getBoolean( + R.styleable.AndroidManifestApplication_allowAudioPlaybackCapture, + owner.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.Q)) { + ai.privateFlags |= ApplicationInfo.PRIVATE_FLAG_ALLOW_AUDIO_PLAYBACK_CAPTURE; + } + ai.maxAspectRatio = sa.getFloat(R.styleable.AndroidManifestApplication_maxAspectRatio, 0); ai.minAspectRatio = sa.getFloat(R.styleable.AndroidManifestApplication_minAspectRatio, 0); diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml index 1053184bc2f..6b8e000777d 100644 --- a/core/res/res/values/attrs_manifest.xml +++ b/core/res/res/values/attrs_manifest.xml @@ -1667,6 +1667,9 @@ This flag is turned on by default. This attribute is usable only by system apps. --> + + + diff --git a/media/java/android/media/AudioPlaybackCaptureConfiguration.java b/media/java/android/media/AudioPlaybackCaptureConfiguration.java index d714dc7772f..9a16aea1e05 100644 --- a/media/java/android/media/AudioPlaybackCaptureConfiguration.java +++ b/media/java/android/media/AudioPlaybackCaptureConfiguration.java @@ -33,7 +33,7 @@ import com.android.internal.util.Preconditions; * - played by apps that MUST be in the same user profile as the capturing app * (eg work profile can not capture user profile apps and vice-versa). * - played by apps that MUST NOT have in their manifest.xml the application - * attribute android:allowPlaybackCapture="false" + * attribute android:allowAudioPlaybackCapture="false" * - played by apps that MUST have a targetSdkVersion higher or equal to 29 (Q). * *

An example for creating a capture configuration for capturing all media playback: diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java index 92fe377e949..59e5d771636 100644 --- a/services/core/java/com/android/server/pm/Settings.java +++ b/services/core/java/com/android/server/pm/Settings.java @@ -4372,6 +4372,7 @@ public final class Settings { ApplicationInfo.PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE, "PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE", ApplicationInfo.PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION, "PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION", ApplicationInfo.PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_UNRESIZEABLE, "PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_UNRESIZEABLE", + ApplicationInfo.PRIVATE_FLAG_ALLOW_AUDIO_PLAYBACK_CAPTURE, "ALLOW_AUDIO_PLAYBACK_CAPTURE", ApplicationInfo.PRIVATE_FLAG_BACKUP_IN_FOREGROUND, "BACKUP_IN_FOREGROUND", ApplicationInfo.PRIVATE_FLAG_CANT_SAVE_STATE, "CANT_SAVE_STATE", ApplicationInfo.PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE, "DEFAULT_TO_DEVICE_PROTECTED_STORAGE", -- GitLab From 1c70a60ea5bc006865ac022d59078d0f688ac3c2 Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Fri, 22 Feb 2019 09:46:32 -0800 Subject: [PATCH 033/398] Expose allowAudioPlaybackCapture to PackageManagerNative Audio playback has both c++ and java API. The flag is needed in the audio policy service in c++ to know if the app can be capture by other apps. Bug: 119500128 Test: dumpsys media.audio_policy Change-Id: I949b5e31039b024a34a9646a18586cff5f8807ab Signed-off-by: Kevin Rocard --- .../com/android/server/pm/PackageManagerService.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 00b02ffa52f..73b5d936aaf 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -23101,6 +23101,18 @@ public class PackageManagerService extends IPackageManager.Stub } return 0; } + + @Override + public boolean[] isAudioPlaybackCaptureAllowed(String[] packageNames) + throws RemoteException { + int callingUser = UserHandle.getUserId(Binder.getCallingUid()); + boolean[] results = new boolean[packageNames.length]; + for (int i = results.length - 1; i >= 0; --i) { + ApplicationInfo appInfo = getApplicationInfo(packageNames[i], 0, callingUser); + results[i] = appInfo == null ? false : appInfo.isAudioPlaybackCaptureAllowed(); + } + return results; + } } private class PackageManagerInternalImpl extends PackageManagerInternal { -- GitLab From 92488ea2b21f1f012bf3ffcce98215ce1649d057 Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Thu, 21 Feb 2019 11:01:25 -0800 Subject: [PATCH 034/398] Allow to project audio from a Screen capture MediaProjection Test: adb shell audiorecorder --target /data/file.raw Bug: 111453086 Change-Id: I81d5f9b3af5ab47757b9075228ce07e30e6a0fcf Signed-off-by: Kevin Rocard --- .../android/media/projection/MediaProjection.java | 11 ----------- .../projection/MediaProjectionManagerService.java | 10 +++++----- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/media/java/android/media/projection/MediaProjection.java b/media/java/android/media/projection/MediaProjection.java index f9c5b8d729c..632cfb0f1e3 100644 --- a/media/java/android/media/projection/MediaProjection.java +++ b/media/java/android/media/projection/MediaProjection.java @@ -21,7 +21,6 @@ import android.annotation.Nullable; import android.content.Context; import android.hardware.display.DisplayManager; import android.hardware.display.VirtualDisplay; -import android.media.AudioRecord; import android.media.projection.IMediaProjection; import android.media.projection.IMediaProjectionCallback; import android.os.Handler; @@ -139,16 +138,6 @@ public final class MediaProjection { handler, null /* uniqueId */); } - /** - * Creates an AudioRecord to capture audio played back by the system. - * @hide - */ - public AudioRecord createAudioRecord( - int sampleRateInHz, int channelConfig, - int audioFormat, int bufferSizeInBytes) { - return null; - } - /** * Stops projection. */ diff --git a/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java b/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java index fccff57e323..270fbc68e14 100644 --- a/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java +++ b/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java @@ -16,17 +16,15 @@ package com.android.server.media.projection; -import com.android.server.Watchdog; - import android.Manifest; import android.app.AppOpsManager; import android.content.Context; import android.content.pm.PackageManager; import android.hardware.display.DisplayManager; import android.media.MediaRouter; -import android.media.projection.IMediaProjectionManager; import android.media.projection.IMediaProjection; import android.media.projection.IMediaProjectionCallback; +import android.media.projection.IMediaProjectionManager; import android.media.projection.IMediaProjectionWatcherCallback; import android.media.projection.MediaProjectionInfo; import android.media.projection.MediaProjectionManager; @@ -41,6 +39,7 @@ import android.util.Slog; import com.android.internal.util.DumpUtils; import com.android.server.SystemService; +import com.android.server.Watchdog; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -361,8 +360,9 @@ public final class MediaProjectionManagerService extends SystemService @Override // Binder call public boolean canProjectAudio() { - return mType == MediaProjectionManager.TYPE_MIRRORING || - mType == MediaProjectionManager.TYPE_PRESENTATION; + return mType == MediaProjectionManager.TYPE_MIRRORING + || mType == MediaProjectionManager.TYPE_PRESENTATION + || mType == MediaProjectionManager.TYPE_SCREEN_CAPTURE; } @Override // Binder call -- GitLab From 8b0e61710d1c5c30bf11f97f7e6b58fb6a3ba4b5 Mon Sep 17 00:00:00 2001 From: Issei Suzuki Date: Mon, 14 Jan 2019 17:04:33 +0100 Subject: [PATCH 035/398] Add comment to clarify use case of the new constructors. Change-Id: Ide57dc749628c4ebaaf436171a3470c723958b64 Test: N/A (changed comment only) Bug: 118675827 --- core/java/android/view/DisplayCutout.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/java/android/view/DisplayCutout.java b/core/java/android/view/DisplayCutout.java index e9f1edf52b5..f040fee081f 100644 --- a/core/java/android/view/DisplayCutout.java +++ b/core/java/android/view/DisplayCutout.java @@ -233,6 +233,9 @@ public final class DisplayCutout { /** * Creates a DisplayCutout instance. * + *

Note that this is only useful for tests. For production code, developers should always + * use a {@link DisplayCutout} obtained from the system.

+ * * @param safeInsets the insets from each edge which avoid the display cutout as returned by * {@link #getSafeInsetTop()} etc. * @param boundLeft the left bounding rect of the display cutout in pixels. If null is passed, @@ -253,6 +256,9 @@ public final class DisplayCutout { /** * Creates a DisplayCutout instance. * + *

Note that this is only useful for tests. For production code, developers should always + * use a {@link DisplayCutout} obtained from the system.

+ * * @param safeInsets the insets from each edge which avoid the display cutout as returned by * {@link #getSafeInsetTop()} etc. * @param boundingRects the bounding rects of the display cutouts as returned by -- GitLab From da6e570f1e1a8c51d1c549dcf1a5b8907cd506bd Mon Sep 17 00:00:00 2001 From: Andrei Onea Date: Mon, 25 Feb 2019 15:24:42 +0000 Subject: [PATCH 036/398] Add @UnsupportedAppUsage annotations For packages: android.database android.hardware android.hardware.display android.hardware.input android.hardware.location android.location android.media android.media.tv android.media.projection This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: I570c08292f8a9f512c96f9dce13f5337718f112c --- config/hiddenapi-greylist.txt | 31 ------------------- .../android/database/BulkCursorNative.java | 2 ++ .../hardware/display/IDisplayManager.aidl | 1 + .../android/hardware/input/IInputManager.aidl | 1 + .../IActivityRecognitionHardwareClient.aidl | 1 + .../android/location/IGeocodeProvider.aidl | 2 ++ .../android/location/IGeofenceProvider.aidl | 1 + .../android/location/ILocationListener.aidl | 4 +++ .../android/location/ILocationManager.aidl | 1 + .../location/INetInitiatedListener.aidl | 1 + .../android/media/IAudioFocusDispatcher.aidl | 1 + media/java/android/media/IAudioService.aidl | 4 +++ .../android/media/IMediaScannerService.aidl | 2 ++ .../android/media/IRemoteDisplayCallback.aidl | 1 + .../projection/IMediaProjectionManager.aidl | 1 + .../media/tv/ITvRemoteServiceInput.aidl | 9 ++++++ 16 files changed, 32 insertions(+), 31 deletions(-) diff --git a/config/hiddenapi-greylist.txt b/config/hiddenapi-greylist.txt index aaff76eb9ae..dc6e7f93525 100644 --- a/config/hiddenapi-greylist.txt +++ b/config/hiddenapi-greylist.txt @@ -437,7 +437,6 @@ Landroid/content/pm/IShortcutService$Stub;->asInterface(Landroid/os/IBinder;)Lan Landroid/content/res/ConfigurationBoundResourceCache;->()V Landroid/content/res/DrawableCache;->()V Landroid/content/UndoManager;->()V -Landroid/database/BulkCursorProxy;->mRemote:Landroid/os/IBinder; Landroid/database/IContentObserver$Stub;->()V Landroid/database/IContentObserver$Stub;->asInterface(Landroid/os/IBinder;)Landroid/database/IContentObserver; Landroid/database/IContentObserver;->onChange(ZLandroid/net/Uri;I)V @@ -446,16 +445,13 @@ Landroid/database/sqlite/SQLiteDatabase;->$assertionsDisabled:Z Landroid/filterfw/GraphEnvironment;->addReferences([Ljava/lang/Object;)V Landroid/hardware/camera2/utils/HashCodeHelpers;->hashCode([I)I Landroid/hardware/display/IDisplayManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/display/IDisplayManager; -Landroid/hardware/display/IDisplayManager;->getDisplayInfo(I)Landroid/view/DisplayInfo; Landroid/hardware/fingerprint/IFingerprintService$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/hardware/fingerprint/IFingerprintService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/fingerprint/IFingerprintService; Landroid/hardware/ICameraService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/ICameraService; Landroid/hardware/input/IInputManager$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/hardware/input/IInputManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/input/IInputManager; Landroid/hardware/input/IInputManager$Stub;->TRANSACTION_injectInputEvent:I -Landroid/hardware/input/IInputManager;->injectInputEvent(Landroid/view/InputEvent;I)Z Landroid/hardware/location/IActivityRecognitionHardwareClient$Stub;->()V -Landroid/hardware/location/IActivityRecognitionHardwareClient;->onAvailabilityChanged(ZLandroid/hardware/location/IActivityRecognitionHardware;)V Landroid/hardware/location/IContextHubService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/location/IContextHubService; Landroid/hardware/usb/IUsbManager$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/hardware/usb/IUsbManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/usb/IUsbManager; @@ -465,60 +461,33 @@ Landroid/location/ICountryDetector$Stub;->asInterface(Landroid/os/IBinder;)Landr Landroid/location/ICountryListener$Stub;->()V Landroid/location/IGeocodeProvider$Stub;->()V Landroid/location/IGeocodeProvider$Stub;->asInterface(Landroid/os/IBinder;)Landroid/location/IGeocodeProvider; -Landroid/location/IGeocodeProvider;->getFromLocation(DDILandroid/location/GeocoderParams;Ljava/util/List;)Ljava/lang/String; -Landroid/location/IGeocodeProvider;->getFromLocationName(Ljava/lang/String;DDDDILandroid/location/GeocoderParams;Ljava/util/List;)Ljava/lang/String; Landroid/location/IGeofenceProvider$Stub;->()V -Landroid/location/IGeofenceProvider;->setGeofenceHardware(Landroid/hardware/location/IGeofenceHardware;)V Landroid/location/ILocationListener$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/location/ILocationListener$Stub$Proxy;->mRemote:Landroid/os/IBinder; Landroid/location/ILocationListener$Stub;->()V Landroid/location/ILocationListener$Stub;->asInterface(Landroid/os/IBinder;)Landroid/location/ILocationListener; -Landroid/location/ILocationListener;->onLocationChanged(Landroid/location/Location;)V -Landroid/location/ILocationListener;->onProviderDisabled(Ljava/lang/String;)V -Landroid/location/ILocationListener;->onProviderEnabled(Ljava/lang/String;)V -Landroid/location/ILocationListener;->onStatusChanged(Ljava/lang/String;ILandroid/os/Bundle;)V Landroid/location/ILocationManager$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/location/ILocationManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/location/ILocationManager; Landroid/location/ILocationManager$Stub;->TRANSACTION_getAllProviders:I -Landroid/location/ILocationManager;->getAllProviders()Ljava/util/List; Landroid/location/INetInitiatedListener$Stub;->()V -Landroid/location/INetInitiatedListener;->sendNiResponse(II)Z Landroid/location/LocationManager$ListenerTransport;->(Landroid/location/LocationManager;Landroid/location/LocationListener;Landroid/os/Looper;)V Landroid/Manifest$permission;->CAPTURE_SECURE_VIDEO_OUTPUT:Ljava/lang/String; Landroid/Manifest$permission;->CAPTURE_VIDEO_OUTPUT:Ljava/lang/String; Landroid/Manifest$permission;->READ_FRAME_BUFFER:Ljava/lang/String; Landroid/media/effect/SingleFilterEffect;->(Landroid/media/effect/EffectContext;Ljava/lang/String;Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V -Landroid/media/IAudioFocusDispatcher;->dispatchAudioFocusChange(ILjava/lang/String;)V Landroid/media/IAudioRoutesObserver$Stub;->()V Landroid/media/IAudioService$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/media/IAudioService$Stub;->()V Landroid/media/IAudioService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/media/IAudioService; -Landroid/media/IAudioService;->getStreamMaxVolume(I)I -Landroid/media/IAudioService;->getStreamVolume(I)I -Landroid/media/IAudioService;->setStreamVolume(IIILjava/lang/String;)V -Landroid/media/IAudioService;->startWatchingRoutes(Landroid/media/IAudioRoutesObserver;)Landroid/media/AudioRoutesInfo; Landroid/media/IMediaRouterService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/media/IMediaRouterService; Landroid/media/IMediaScannerListener$Stub;->()V Landroid/media/IMediaScannerService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/media/IMediaScannerService; -Landroid/media/IMediaScannerService;->requestScanFile(Ljava/lang/String;Ljava/lang/String;Landroid/media/IMediaScannerListener;)V -Landroid/media/IMediaScannerService;->scanFile(Ljava/lang/String;Ljava/lang/String;)V -Landroid/media/IRemoteDisplayCallback;->onStateChanged(Landroid/media/RemoteDisplayState;)V Landroid/media/IRingtonePlayer;->play(Landroid/os/IBinder;Landroid/net/Uri;Landroid/media/AudioAttributes;FZ)V Landroid/media/IVolumeController$Stub;->asInterface(Landroid/os/IBinder;)Landroid/media/IVolumeController; Landroid/media/MediaFile;->()V Landroid/media/MediaScanner$MyMediaScannerClient;->(Landroid/media/MediaScanner;)V -Landroid/media/projection/IMediaProjectionManager;->hasProjectionPermission(ILjava/lang/String;)Z Landroid/media/session/ISessionManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/media/session/ISessionManager; Landroid/media/tv/ITvRemoteProvider$Stub;->()V -Landroid/media/tv/ITvRemoteServiceInput;->clearInputBridge(Landroid/os/IBinder;)V -Landroid/media/tv/ITvRemoteServiceInput;->closeInputBridge(Landroid/os/IBinder;)V -Landroid/media/tv/ITvRemoteServiceInput;->openInputBridge(Landroid/os/IBinder;Ljava/lang/String;III)V -Landroid/media/tv/ITvRemoteServiceInput;->sendKeyDown(Landroid/os/IBinder;I)V -Landroid/media/tv/ITvRemoteServiceInput;->sendKeyUp(Landroid/os/IBinder;I)V -Landroid/media/tv/ITvRemoteServiceInput;->sendPointerDown(Landroid/os/IBinder;III)V -Landroid/media/tv/ITvRemoteServiceInput;->sendPointerSync(Landroid/os/IBinder;)V -Landroid/media/tv/ITvRemoteServiceInput;->sendPointerUp(Landroid/os/IBinder;I)V -Landroid/media/tv/ITvRemoteServiceInput;->sendTimestamp(Landroid/os/IBinder;J)V Landroid/net/ConnectivityManager$PacketKeepaliveCallback;->()V Landroid/net/IConnectivityManager$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/net/IConnectivityManager$Stub$Proxy;->getActiveLinkProperties()Landroid/net/LinkProperties; diff --git a/core/java/android/database/BulkCursorNative.java b/core/java/android/database/BulkCursorNative.java index d3c11e785d7..77a13cf8007 100644 --- a/core/java/android/database/BulkCursorNative.java +++ b/core/java/android/database/BulkCursorNative.java @@ -16,6 +16,7 @@ package android.database; +import android.annotation.UnsupportedAppUsage; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; @@ -138,6 +139,7 @@ public abstract class BulkCursorNative extends Binder implements IBulkCursor final class BulkCursorProxy implements IBulkCursor { + @UnsupportedAppUsage private IBinder mRemote; private Bundle mExtras; diff --git a/core/java/android/hardware/display/IDisplayManager.aidl b/core/java/android/hardware/display/IDisplayManager.aidl index 5ea8bd67ce7..edd20519bb5 100644 --- a/core/java/android/hardware/display/IDisplayManager.aidl +++ b/core/java/android/hardware/display/IDisplayManager.aidl @@ -30,6 +30,7 @@ import android.view.Surface; /** @hide */ interface IDisplayManager { + @UnsupportedAppUsage DisplayInfo getDisplayInfo(int displayId); int[] getDisplayIds(); diff --git a/core/java/android/hardware/input/IInputManager.aidl b/core/java/android/hardware/input/IInputManager.aidl index 64448fd98bf..2923bbf14c3 100644 --- a/core/java/android/hardware/input/IInputManager.aidl +++ b/core/java/android/hardware/input/IInputManager.aidl @@ -45,6 +45,7 @@ interface IInputManager { // Injects an input event into the system. To inject into windows owned by other // applications, the caller must have the INJECT_EVENTS permission. + @UnsupportedAppUsage boolean injectInputEvent(in InputEvent ev, int mode); // Calibrate input device position diff --git a/core/java/android/hardware/location/IActivityRecognitionHardwareClient.aidl b/core/java/android/hardware/location/IActivityRecognitionHardwareClient.aidl index 3fe645c59a3..2dfaf601c6f 100644 --- a/core/java/android/hardware/location/IActivityRecognitionHardwareClient.aidl +++ b/core/java/android/hardware/location/IActivityRecognitionHardwareClient.aidl @@ -32,5 +32,6 @@ oneway interface IActivityRecognitionHardwareClient { * @param isSupported whether the platform has hardware support for the feature * @param instance the available instance to provide access to the feature */ + @UnsupportedAppUsage void onAvailabilityChanged(in boolean isSupported, in IActivityRecognitionHardware instance); } diff --git a/location/java/android/location/IGeocodeProvider.aidl b/location/java/android/location/IGeocodeProvider.aidl index aaa70c74778..7eaf7b84c83 100644 --- a/location/java/android/location/IGeocodeProvider.aidl +++ b/location/java/android/location/IGeocodeProvider.aidl @@ -26,9 +26,11 @@ import android.location.GeocoderParams; */ interface IGeocodeProvider { + @UnsupportedAppUsage String getFromLocation(double latitude, double longitude, int maxResults, in GeocoderParams params, out List
addrs); + @UnsupportedAppUsage String getFromLocationName(String locationName, double lowerLeftLatitude, double lowerLeftLongitude, double upperRightLatitude, double upperRightLongitude, int maxResults, diff --git a/location/java/android/location/IGeofenceProvider.aidl b/location/java/android/location/IGeofenceProvider.aidl index d4ff0dd70bf..426ebef86b9 100644 --- a/location/java/android/location/IGeofenceProvider.aidl +++ b/location/java/android/location/IGeofenceProvider.aidl @@ -24,5 +24,6 @@ import android.hardware.location.IGeofenceHardware; * {@hide} */ oneway interface IGeofenceProvider { + @UnsupportedAppUsage void setGeofenceHardware(in IGeofenceHardware proxy); } diff --git a/location/java/android/location/ILocationListener.aidl b/location/java/android/location/ILocationListener.aidl index 180183e7766..ec1134566b2 100644 --- a/location/java/android/location/ILocationListener.aidl +++ b/location/java/android/location/ILocationListener.aidl @@ -25,10 +25,14 @@ import android.os.Bundle; */ oneway interface ILocationListener { + @UnsupportedAppUsage void onLocationChanged(in Location location); + @UnsupportedAppUsage void onProviderEnabled(String provider); + @UnsupportedAppUsage void onProviderDisabled(String provider); // --- deprecated --- + @UnsupportedAppUsage void onStatusChanged(String provider, int status, in Bundle extras); } diff --git a/location/java/android/location/ILocationManager.aidl b/location/java/android/location/ILocationManager.aidl index 57a0a725fb4..bb75c77f7e6 100644 --- a/location/java/android/location/ILocationManager.aidl +++ b/location/java/android/location/ILocationManager.aidl @@ -85,6 +85,7 @@ interface ILocationManager boolean stopGnssBatch(); boolean injectLocation(in Location location); + @UnsupportedAppUsage List getAllProviders(); List getProviders(in Criteria criteria, boolean enabledOnly); String getBestProvider(in Criteria criteria, boolean enabledOnly); diff --git a/location/java/android/location/INetInitiatedListener.aidl b/location/java/android/location/INetInitiatedListener.aidl index fc64dd67c11..a9e9136d331 100644 --- a/location/java/android/location/INetInitiatedListener.aidl +++ b/location/java/android/location/INetInitiatedListener.aidl @@ -22,5 +22,6 @@ package android.location; */ interface INetInitiatedListener { + @UnsupportedAppUsage boolean sendNiResponse(int notifId, int userResponse); } diff --git a/media/java/android/media/IAudioFocusDispatcher.aidl b/media/java/android/media/IAudioFocusDispatcher.aidl index 3b33c5b7a46..e3512fa58a7 100644 --- a/media/java/android/media/IAudioFocusDispatcher.aidl +++ b/media/java/android/media/IAudioFocusDispatcher.aidl @@ -23,6 +23,7 @@ package android.media; */ oneway interface IAudioFocusDispatcher { + @UnsupportedAppUsage void dispatchAudioFocusChange(int focusChange, String clientId); void dispatchFocusResultFromExtPolicy(int requestResult, String clientId); diff --git a/media/java/android/media/IAudioService.aidl b/media/java/android/media/IAudioService.aidl index 571e67e1ccf..cf6d095af70 100644 --- a/media/java/android/media/IAudioService.aidl +++ b/media/java/android/media/IAudioService.aidl @@ -64,6 +64,7 @@ interface IAudioService { void adjustStreamVolume(int streamType, int direction, int flags, String callingPackage); + @UnsupportedAppUsage void setStreamVolume(int streamType, int index, int flags, String callingPackage); boolean isStreamMute(int streamType); @@ -74,10 +75,12 @@ interface IAudioService { void setMasterMute(boolean mute, int flags, String callingPackage, int userId); + @UnsupportedAppUsage int getStreamVolume(int streamType); int getStreamMinVolume(int streamType); + @UnsupportedAppUsage int getStreamMaxVolume(int streamType); int getLastAudibleStreamVolume(int streamType); @@ -157,6 +160,7 @@ interface IAudioService { int handleBluetoothA2dpActiveDeviceChange(in BluetoothDevice device, int state, int profile, boolean suppressNoisyIntent, int a2dpVolume); + @UnsupportedAppUsage AudioRoutesInfo startWatchingRoutes(in IAudioRoutesObserver observer); boolean isCameraSoundForced(); diff --git a/media/java/android/media/IMediaScannerService.aidl b/media/java/android/media/IMediaScannerService.aidl index c5316461ef1..24b5595510f 100644 --- a/media/java/android/media/IMediaScannerService.aidl +++ b/media/java/android/media/IMediaScannerService.aidl @@ -31,6 +31,7 @@ interface IMediaScannerService * @param listener an optional IMediaScannerListener. * If specified, the caller will be notified when scanning is complete via the listener. */ + @UnsupportedAppUsage void requestScanFile(String path, String mimeType, in IMediaScannerListener listener); /** @@ -40,5 +41,6 @@ interface IMediaScannerService * @param mimeType an optional mimeType for the file. * If mimeType is null, then the mimeType will be inferred from the file extension. */ + @UnsupportedAppUsage void scanFile(String path, String mimeType); } diff --git a/media/java/android/media/IRemoteDisplayCallback.aidl b/media/java/android/media/IRemoteDisplayCallback.aidl index 19cf070aa08..584417d6512 100644 --- a/media/java/android/media/IRemoteDisplayCallback.aidl +++ b/media/java/android/media/IRemoteDisplayCallback.aidl @@ -22,5 +22,6 @@ import android.media.RemoteDisplayState; * {@hide} */ oneway interface IRemoteDisplayCallback { + @UnsupportedAppUsage void onStateChanged(in RemoteDisplayState state); } diff --git a/media/java/android/media/projection/IMediaProjectionManager.aidl b/media/java/android/media/projection/IMediaProjectionManager.aidl index 7e10c51fc5c..d190fcec6c8 100644 --- a/media/java/android/media/projection/IMediaProjectionManager.aidl +++ b/media/java/android/media/projection/IMediaProjectionManager.aidl @@ -24,6 +24,7 @@ import android.os.IBinder; /** {@hide} */ interface IMediaProjectionManager { + @UnsupportedAppUsage boolean hasProjectionPermission(int uid, String packageName); IMediaProjection createProjection(int uid, String packageName, int type, boolean permanentGrant); diff --git a/media/java/android/media/tv/ITvRemoteServiceInput.aidl b/media/java/android/media/tv/ITvRemoteServiceInput.aidl index df39299c0f9..a0b6c9bfc8d 100644 --- a/media/java/android/media/tv/ITvRemoteServiceInput.aidl +++ b/media/java/android/media/tv/ITvRemoteServiceInput.aidl @@ -21,13 +21,22 @@ package android.media.tv; */ oneway interface ITvRemoteServiceInput { // InputBridge related + @UnsupportedAppUsage void openInputBridge(IBinder token, String name, int width, int height, int maxPointers); + @UnsupportedAppUsage void closeInputBridge(IBinder token); + @UnsupportedAppUsage void clearInputBridge(IBinder token); + @UnsupportedAppUsage void sendTimestamp(IBinder token, long timestamp); + @UnsupportedAppUsage void sendKeyDown(IBinder token, int keyCode); + @UnsupportedAppUsage void sendKeyUp(IBinder token, int keyCode); + @UnsupportedAppUsage void sendPointerDown(IBinder token, int pointerId, int x, int y); + @UnsupportedAppUsage void sendPointerUp(IBinder token, int pointerId); + @UnsupportedAppUsage void sendPointerSync(IBinder token); } \ No newline at end of file -- GitLab From 9a8b6bf0f12b3725d56831ba484623c7f6246def Mon Sep 17 00:00:00 2001 From: Andrei Onea Date: Mon, 25 Feb 2019 13:25:32 +0000 Subject: [PATCH 037/398] Add @UnsupportedAppUsage annotations For packages: android.net android.net.wifi android.nfc This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: I7489aad1dceeb18ed7ca48a1ed8829a668b3fa04 --- config/hiddenapi-greylist.txt | 38 ------------------- .../android/net/IConnectivityManager.aidl | 11 ++++++ .../android/net/INetworkPolicyManager.aidl | 7 ++++ .../android/net/INetworkStatsService.aidl | 5 +++ .../android/net/INetworkStatsSession.aidl | 5 +++ core/java/android/nfc/INfcAdapterExtras.aidl | 7 ++++ wifi/java/android/net/wifi/IWifiManager.aidl | 3 ++ 7 files changed, 38 insertions(+), 38 deletions(-) diff --git a/config/hiddenapi-greylist.txt b/config/hiddenapi-greylist.txt index aaff76eb9ae..63604d7054d 100644 --- a/config/hiddenapi-greylist.txt +++ b/config/hiddenapi-greylist.txt @@ -530,41 +530,13 @@ Landroid/net/IConnectivityManager$Stub$Proxy;->getTetherableUsbRegexs()[Ljava/la Landroid/net/IConnectivityManager$Stub$Proxy;->getTetheredIfaces()[Ljava/lang/String; Landroid/net/IConnectivityManager$Stub$Proxy;->mRemote:Landroid/os/IBinder; Landroid/net/IConnectivityManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/IConnectivityManager; -Landroid/net/IConnectivityManager;->getActiveLinkProperties()Landroid/net/LinkProperties; -Landroid/net/IConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo; -Landroid/net/IConnectivityManager;->getAllNetworkInfo()[Landroid/net/NetworkInfo; -Landroid/net/IConnectivityManager;->getAllNetworkState()[Landroid/net/NetworkState; -Landroid/net/IConnectivityManager;->getLastTetherError(Ljava/lang/String;)I -Landroid/net/IConnectivityManager;->getTetherableIfaces()[Ljava/lang/String; -Landroid/net/IConnectivityManager;->getTetherableUsbRegexs()[Ljava/lang/String; -Landroid/net/IConnectivityManager;->getTetherableWifiRegexs()[Ljava/lang/String; -Landroid/net/IConnectivityManager;->getTetheredIfaces()[Ljava/lang/String; -Landroid/net/IConnectivityManager;->getTetheringErroredIfaces()[Ljava/lang/String; -Landroid/net/IConnectivityManager;->startLegacyVpn(Lcom/android/internal/net/VpnProfile;)V Landroid/net/INetworkManagementEventObserver$Stub;->()V Landroid/net/INetworkPolicyListener$Stub;->()V Landroid/net/INetworkPolicyManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/INetworkPolicyManager; -Landroid/net/INetworkPolicyManager;->getNetworkQuotaInfo(Landroid/net/NetworkState;)Landroid/net/NetworkQuotaInfo; -Landroid/net/INetworkPolicyManager;->getRestrictBackground()Z -Landroid/net/INetworkPolicyManager;->getUidPolicy(I)I -Landroid/net/INetworkPolicyManager;->setNetworkPolicies([Landroid/net/NetworkPolicy;)V -Landroid/net/INetworkPolicyManager;->setRestrictBackground(Z)V -Landroid/net/INetworkPolicyManager;->setUidPolicy(II)V -Landroid/net/INetworkPolicyManager;->snoozeLimit(Landroid/net/NetworkTemplate;)V Landroid/net/INetworkScoreService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/INetworkScoreService; Landroid/net/INetworkStatsService$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/net/INetworkStatsService$Stub$Proxy;->getMobileIfaces()[Ljava/lang/String; Landroid/net/INetworkStatsService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/INetworkStatsService; -Landroid/net/INetworkStatsService;->forceUpdate()V -Landroid/net/INetworkStatsService;->getDataLayerSnapshotForUid(I)Landroid/net/NetworkStats; -Landroid/net/INetworkStatsService;->getMobileIfaces()[Ljava/lang/String; -Landroid/net/INetworkStatsService;->openSession()Landroid/net/INetworkStatsSession; -Landroid/net/INetworkStatsService;->openSessionForUsageStats(ILjava/lang/String;)Landroid/net/INetworkStatsSession; -Landroid/net/INetworkStatsSession;->close()V -Landroid/net/INetworkStatsSession;->getHistoryForNetwork(Landroid/net/NetworkTemplate;I)Landroid/net/NetworkStatsHistory; -Landroid/net/INetworkStatsSession;->getHistoryForUid(Landroid/net/NetworkTemplate;IIII)Landroid/net/NetworkStatsHistory; -Landroid/net/INetworkStatsSession;->getSummaryForAllUid(Landroid/net/NetworkTemplate;JJZ)Landroid/net/NetworkStats; -Landroid/net/INetworkStatsSession;->getSummaryForNetwork(Landroid/net/NetworkTemplate;JJ)Landroid/net/NetworkStats; Landroid/net/InterfaceConfiguration;->()V Landroid/net/LinkProperties$ProvisioningChange;->values()[Landroid/net/LinkProperties$ProvisioningChange; Landroid/net/MobileLinkQualityInfo;->()V @@ -575,22 +547,12 @@ Landroid/net/SntpClient;->()V Landroid/net/wifi/IWifiManager$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/net/wifi/IWifiManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/wifi/IWifiManager; Landroid/net/wifi/IWifiManager$Stub;->TRANSACTION_getScanResults:I -Landroid/net/wifi/IWifiManager;->getCurrentNetwork()Landroid/net/Network; -Landroid/net/wifi/IWifiManager;->getWifiApConfiguration()Landroid/net/wifi/WifiConfiguration; -Landroid/net/wifi/IWifiManager;->getWifiApEnabledState()I Landroid/net/wifi/IWifiScanner$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/net/wifi/IWifiScanner$Stub$Proxy;->mRemote:Landroid/os/IBinder; Landroid/net/wifi/IWifiScanner$Stub;->()V Landroid/net/wifi/IWifiScanner$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/wifi/IWifiScanner; Landroid/net/wifi/p2p/IWifiP2pManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/wifi/p2p/IWifiP2pManager; Landroid/nfc/INfcAdapter$Stub;->TRANSACTION_enable:I -Landroid/nfc/INfcAdapterExtras;->authenticate(Ljava/lang/String;[B)V -Landroid/nfc/INfcAdapterExtras;->close(Ljava/lang/String;Landroid/os/IBinder;)Landroid/os/Bundle; -Landroid/nfc/INfcAdapterExtras;->getCardEmulationRoute(Ljava/lang/String;)I -Landroid/nfc/INfcAdapterExtras;->getDriverName(Ljava/lang/String;)Ljava/lang/String; -Landroid/nfc/INfcAdapterExtras;->open(Ljava/lang/String;Landroid/os/IBinder;)Landroid/os/Bundle; -Landroid/nfc/INfcAdapterExtras;->setCardEmulationRoute(Ljava/lang/String;I)V -Landroid/nfc/INfcAdapterExtras;->transceive(Ljava/lang/String;[B)Landroid/os/Bundle; Landroid/os/AsyncResult;->(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Throwable;)V Landroid/os/AsyncResult;->exception:Ljava/lang/Throwable; Landroid/os/AsyncResult;->forMessage(Landroid/os/Message;)Landroid/os/AsyncResult; diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl index 87c62d2f10a..bd2b4eb3230 100644 --- a/core/java/android/net/IConnectivityManager.aidl +++ b/core/java/android/net/IConnectivityManager.aidl @@ -47,10 +47,12 @@ interface IConnectivityManager { Network getActiveNetwork(); Network getActiveNetworkForUid(int uid, boolean ignoreBlocked); + @UnsupportedAppUsage NetworkInfo getActiveNetworkInfo(); NetworkInfo getActiveNetworkInfoForUid(int uid, boolean ignoreBlocked); NetworkInfo getNetworkInfo(int networkType); NetworkInfo getNetworkInfoForUid(in Network network, int uid, boolean ignoreBlocked); + @UnsupportedAppUsage NetworkInfo[] getAllNetworkInfo(); Network getNetworkForType(int networkType); Network[] getAllNetworks(); @@ -58,12 +60,14 @@ interface IConnectivityManager boolean isNetworkSupported(int networkType); + @UnsupportedAppUsage LinkProperties getActiveLinkProperties(); LinkProperties getLinkPropertiesForType(int networkType); LinkProperties getLinkProperties(in Network network); NetworkCapabilities getNetworkCapabilities(in Network network); + @UnsupportedAppUsage NetworkState[] getAllNetworkState(); NetworkQuotaInfo getActiveNetworkQuotaInfo(); @@ -75,6 +79,7 @@ interface IConnectivityManager int untether(String iface, String callerPkg); + @UnsupportedAppUsage int getLastTetherError(String iface); boolean isTetheringSupported(String callerPkg); @@ -84,16 +89,21 @@ interface IConnectivityManager void stopTethering(int type, String callerPkg); + @UnsupportedAppUsage String[] getTetherableIfaces(); + @UnsupportedAppUsage String[] getTetheredIfaces(); + @UnsupportedAppUsage String[] getTetheringErroredIfaces(); String[] getTetheredDhcpRanges(); + @UnsupportedAppUsage String[] getTetherableUsbRegexs(); + @UnsupportedAppUsage String[] getTetherableWifiRegexs(); String[] getTetherableBluetoothRegexs(); @@ -118,6 +128,7 @@ interface IConnectivityManager VpnConfig getVpnConfig(int userId); + @UnsupportedAppUsage void startLegacyVpn(in VpnProfile profile); LegacyVpnInfo getLegacyVpnInfo(int userId); diff --git a/core/java/android/net/INetworkPolicyManager.aidl b/core/java/android/net/INetworkPolicyManager.aidl index e92302a939d..385cb1d68b5 100644 --- a/core/java/android/net/INetworkPolicyManager.aidl +++ b/core/java/android/net/INetworkPolicyManager.aidl @@ -31,9 +31,11 @@ import android.telephony.SubscriptionPlan; interface INetworkPolicyManager { /** Control UID policies. */ + @UnsupportedAppUsage void setUidPolicy(int uid, int policy); void addUidPolicy(int uid, int policy); void removeUidPolicy(int uid, int policy); + @UnsupportedAppUsage int getUidPolicy(int uid); int[] getUidsWithPolicy(int policy); @@ -41,14 +43,18 @@ interface INetworkPolicyManager { void unregisterListener(INetworkPolicyListener listener); /** Control network policies atomically. */ + @UnsupportedAppUsage void setNetworkPolicies(in NetworkPolicy[] policies); NetworkPolicy[] getNetworkPolicies(String callingPackage); /** Snooze limit on policy matching given template. */ + @UnsupportedAppUsage void snoozeLimit(in NetworkTemplate template); /** Control if background data is restricted system-wide. */ + @UnsupportedAppUsage void setRestrictBackground(boolean restrictBackground); + @UnsupportedAppUsage boolean getRestrictBackground(); /** Callback used to change internal state on tethering */ @@ -64,6 +70,7 @@ interface INetworkPolicyManager { void setDeviceIdleMode(boolean enabled); void setWifiMeteredOverride(String networkId, int meteredOverride); + @UnsupportedAppUsage NetworkQuotaInfo getNetworkQuotaInfo(in NetworkState state); SubscriptionPlan[] getSubscriptionPlans(int subId, String callingPackage); diff --git a/core/java/android/net/INetworkStatsService.aidl b/core/java/android/net/INetworkStatsService.aidl index 8e6f2723884..92b685c4b51 100644 --- a/core/java/android/net/INetworkStatsService.aidl +++ b/core/java/android/net/INetworkStatsService.aidl @@ -29,6 +29,7 @@ import android.os.Messenger; interface INetworkStatsService { /** Start a statistics query session. */ + @UnsupportedAppUsage INetworkStatsSession openSession(); /** Start a statistics query session. If calling package is profile or device owner then it is @@ -37,9 +38,11 @@ interface INetworkStatsService { * PACKAGE_USAGE_STATS permission is always checked. If PACKAGE_USAGE_STATS is not granted * READ_NETWORK_USAGE_STATS is checked for. */ + @UnsupportedAppUsage INetworkStatsSession openSessionForUsageStats(int flags, String callingPackage); /** Return data layer snapshot of UID network usage. */ + @UnsupportedAppUsage NetworkStats getDataLayerSnapshotForUid(int uid); /** Get a detailed snapshot of stats since boot for all UIDs. @@ -52,6 +55,7 @@ interface INetworkStatsService { NetworkStats getDetailedUidStats(in String[] requiredIfaces); /** Return set of any ifaces associated with mobile networks since boot. */ + @UnsupportedAppUsage String[] getMobileIfaces(); /** Increment data layer count of operations performed for UID and tag. */ @@ -60,6 +64,7 @@ interface INetworkStatsService { /** Force update of ifaces. */ void forceUpdateIfaces(in Network[] defaultNetworks); /** Force update of statistics. */ + @UnsupportedAppUsage void forceUpdate(); /** Registers a callback on data usage. */ diff --git a/core/java/android/net/INetworkStatsSession.aidl b/core/java/android/net/INetworkStatsSession.aidl index 5229a3b3b9f..f13f2cb664b 100644 --- a/core/java/android/net/INetworkStatsSession.aidl +++ b/core/java/android/net/INetworkStatsSession.aidl @@ -27,13 +27,17 @@ interface INetworkStatsSession { NetworkStats getDeviceSummaryForNetwork(in NetworkTemplate template, long start, long end); /** Return network layer usage summary for traffic that matches template. */ + @UnsupportedAppUsage NetworkStats getSummaryForNetwork(in NetworkTemplate template, long start, long end); /** Return historical network layer stats for traffic that matches template. */ + @UnsupportedAppUsage NetworkStatsHistory getHistoryForNetwork(in NetworkTemplate template, int fields); /** Return network layer usage summary per UID for traffic that matches template. */ + @UnsupportedAppUsage NetworkStats getSummaryForAllUid(in NetworkTemplate template, long start, long end, boolean includeTags); /** Return historical network layer stats for specific UID traffic that matches template. */ + @UnsupportedAppUsage NetworkStatsHistory getHistoryForUid(in NetworkTemplate template, int uid, int set, int tag, int fields); /** Return historical network layer stats for specific UID traffic that matches template. */ NetworkStatsHistory getHistoryIntervalForUid(in NetworkTemplate template, int uid, int set, int tag, int fields, long start, long end); @@ -41,6 +45,7 @@ interface INetworkStatsSession { /** Return array of uids that have stats and are accessible to the calling user */ int[] getRelevantUids(); + @UnsupportedAppUsage void close(); } diff --git a/core/java/android/nfc/INfcAdapterExtras.aidl b/core/java/android/nfc/INfcAdapterExtras.aidl index 41ebf636c89..dd260bc6f2f 100644 --- a/core/java/android/nfc/INfcAdapterExtras.aidl +++ b/core/java/android/nfc/INfcAdapterExtras.aidl @@ -23,11 +23,18 @@ import android.os.Bundle; * {@hide} */ interface INfcAdapterExtras { + @UnsupportedAppUsage Bundle open(in String pkg, IBinder b); + @UnsupportedAppUsage Bundle close(in String pkg, IBinder b); + @UnsupportedAppUsage Bundle transceive(in String pkg, in byte[] data_in); + @UnsupportedAppUsage int getCardEmulationRoute(in String pkg); + @UnsupportedAppUsage void setCardEmulationRoute(in String pkg, int route); + @UnsupportedAppUsage void authenticate(in String pkg, in byte[] token); + @UnsupportedAppUsage String getDriverName(in String pkg); } diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl index d5497990aef..17948e7e1bc 100644 --- a/wifi/java/android/net/wifi/IWifiManager.aidl +++ b/wifi/java/android/net/wifi/IWifiManager.aidl @@ -147,8 +147,10 @@ interface IWifiManager void stopWatchLocalOnlyHotspot(); + @UnsupportedAppUsage int getWifiApEnabledState(); + @UnsupportedAppUsage WifiConfiguration getWifiApConfiguration(); boolean setWifiApConfiguration(in WifiConfiguration wifiConfig, String packageName); @@ -173,6 +175,7 @@ interface IWifiManager void factoryReset(String packageName); + @UnsupportedAppUsage Network getCurrentNetwork(); byte[] retrieveBackupData(); -- GitLab From f650e3c286ff6fe112bd415c6f49fd0e874abfb9 Mon Sep 17 00:00:00 2001 From: Andrei Onea Date: Mon, 25 Feb 2019 13:15:54 +0000 Subject: [PATCH 038/398] Add @UnsupportedAppUsage annotations For packages: android.app.admin android.app.backup android.app.job android.app.usage android.content android.content.om android.content.pm This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: Id84ee490f3435a196fca10a89bda9f7217b750c6 --- config/hiddenapi-greylist.txt | 106 ------------------ .../app/admin/IDevicePolicyManager.aidl | 1 + .../android/app/backup/IBackupManager.aidl | 10 ++ core/java/android/app/job/IJobCallback.aidl | 5 + core/java/android/app/job/IJobService.aidl | 2 + .../android/app/usage/IUsageStatsManager.aidl | 4 + .../content/ContentProviderNative.java | 1 + .../java/android/content/IContentService.aidl | 6 + .../java/android/content/IIntentReceiver.aidl | 1 + core/java/android/content/ISyncAdapter.aidl | 3 + .../android/content/ISyncServiceAdapter.aidl | 2 + .../android/content/ISyncStatusObserver.aidl | 1 + .../android/content/om/IOverlayManager.aidl | 2 + .../content/pm/IPackageDataObserver.aidl | 1 + .../content/pm/IPackageDeleteObserver.aidl | 1 + .../content/pm/IPackageDeleteObserver2.aidl | 1 + .../content/pm/IPackageInstallObserver2.aidl | 2 + .../android/content/pm/IPackageInstaller.aidl | 1 + .../content/pm/IPackageInstallerCallback.aidl | 5 + .../android/content/pm/IPackageManager.aidl | 56 +++++++++ .../content/pm/IPackageStatsObserver.aidl | 1 + 21 files changed, 106 insertions(+), 106 deletions(-) diff --git a/config/hiddenapi-greylist.txt b/config/hiddenapi-greylist.txt index aaff76eb9ae..3770b45a8ad 100644 --- a/config/hiddenapi-greylist.txt +++ b/config/hiddenapi-greylist.txt @@ -36,18 +36,7 @@ Landroid/app/ActivityThread$H;->(Landroid/app/ActivityThread;)V Landroid/app/admin/IDevicePolicyManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/admin/IDevicePolicyManager; Landroid/app/admin/IDevicePolicyManager$Stub;->TRANSACTION_packageHasActiveAdmins:I Landroid/app/admin/IDevicePolicyManager$Stub;->TRANSACTION_removeActiveAdmin:I -Landroid/app/admin/IDevicePolicyManager;->packageHasActiveAdmins(Ljava/lang/String;I)Z Landroid/app/backup/IBackupManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/backup/IBackupManager; -Landroid/app/backup/IBackupManager;->acknowledgeFullBackupOrRestore(IZLjava/lang/String;Ljava/lang/String;Landroid/app/backup/IFullBackupRestoreObserver;)V -Landroid/app/backup/IBackupManager;->clearBackupData(Ljava/lang/String;Ljava/lang/String;)V -Landroid/app/backup/IBackupManager;->dataChanged(Ljava/lang/String;)V -Landroid/app/backup/IBackupManager;->getCurrentTransport()Ljava/lang/String; -Landroid/app/backup/IBackupManager;->isBackupEnabled()Z -Landroid/app/backup/IBackupManager;->isBackupServiceActive(I)Z -Landroid/app/backup/IBackupManager;->listAllTransports()[Ljava/lang/String; -Landroid/app/backup/IBackupManager;->selectBackupTransport(Ljava/lang/String;)Ljava/lang/String; -Landroid/app/backup/IBackupManager;->setAutoRestore(Z)V -Landroid/app/backup/IBackupManager;->setBackupEnabled(Z)V Landroid/app/backup/IFullBackupRestoreObserver$Stub;->()V Landroid/app/backup/IRestoreObserver$Stub;->()V Landroid/app/DownloadManager;->restartDownload([J)V @@ -215,19 +204,12 @@ Landroid/app/job/IJobCallback$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/app/job/IJobCallback$Stub$Proxy;->mRemote:Landroid/os/IBinder; Landroid/app/job/IJobCallback$Stub;->()V Landroid/app/job/IJobCallback$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/job/IJobCallback; -Landroid/app/job/IJobCallback;->acknowledgeStartMessage(IZ)V -Landroid/app/job/IJobCallback;->acknowledgeStopMessage(IZ)V -Landroid/app/job/IJobCallback;->completeWork(II)Z -Landroid/app/job/IJobCallback;->dequeueWork(I)Landroid/app/job/JobWorkItem; -Landroid/app/job/IJobCallback;->jobFinished(IZ)V Landroid/app/job/IJobScheduler$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/app/job/IJobScheduler$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/job/IJobScheduler; Landroid/app/job/IJobService$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/app/job/IJobService$Stub$Proxy;->mRemote:Landroid/os/IBinder; Landroid/app/job/IJobService$Stub;->()V Landroid/app/job/IJobService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/job/IJobService; -Landroid/app/job/IJobService;->startJob(Landroid/app/job/JobParameters;)V -Landroid/app/job/IJobService;->stopJob(Landroid/app/job/JobParameters;)V Landroid/app/PackageDeleteObserver;->()V Landroid/app/PackageInstallObserver;->()V Landroid/app/ReceiverRestrictedContext;->(Landroid/content/Context;)V @@ -237,10 +219,6 @@ Landroid/app/TaskStackListener;->()V Landroid/app/trust/ITrustManager$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/app/UiAutomationConnection;->()V Landroid/app/usage/IUsageStatsManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/usage/IUsageStatsManager; -Landroid/app/usage/IUsageStatsManager;->isAppInactive(Ljava/lang/String;I)Z -Landroid/app/usage/IUsageStatsManager;->queryConfigurationStats(IJJLjava/lang/String;)Landroid/content/pm/ParceledListSlice; -Landroid/app/usage/IUsageStatsManager;->queryUsageStats(IJJLjava/lang/String;)Landroid/content/pm/ParceledListSlice; -Landroid/app/usage/IUsageStatsManager;->setAppInactive(Ljava/lang/String;ZI)V Landroid/app/UserSwitchObserver;->()V Landroid/bluetooth/IBluetooth$Stub$Proxy;->getAddress()Ljava/lang/String; Landroid/bluetooth/IBluetooth$Stub$Proxy;->getConnectionState(Landroid/bluetooth/BluetoothDevice;)I @@ -284,22 +262,14 @@ Landroid/companion/ICompanionDeviceDiscoveryService$Stub;->()V Landroid/companion/ICompanionDeviceDiscoveryServiceCallback;->onDeviceSelected(Ljava/lang/String;ILjava/lang/String;)V Landroid/companion/ICompanionDeviceDiscoveryServiceCallback;->onDeviceSelectionCancel()V Landroid/companion/IFindDeviceCallback;->onSuccess(Landroid/app/PendingIntent;)V -Landroid/content/ContentProviderProxy;->mRemote:Landroid/os/IBinder; Landroid/content/IClipboard$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/content/IClipboard$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/IClipboard; Landroid/content/IContentService$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/content/IContentService$Stub;->()V Landroid/content/IContentService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/IContentService; -Landroid/content/IContentService;->cancelSync(Landroid/accounts/Account;Ljava/lang/String;Landroid/content/ComponentName;)V -Landroid/content/IContentService;->getIsSyncable(Landroid/accounts/Account;Ljava/lang/String;)I -Landroid/content/IContentService;->getMasterSyncAutomatically()Z -Landroid/content/IContentService;->getSyncAdapterTypes()[Landroid/content/SyncAdapterType; -Landroid/content/IContentService;->isSyncActive(Landroid/accounts/Account;Ljava/lang/String;Landroid/content/ComponentName;)Z -Landroid/content/IContentService;->setMasterSyncAutomatically(Z)V Landroid/content/IIntentReceiver$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/content/IIntentReceiver$Stub$Proxy;->mRemote:Landroid/os/IBinder; Landroid/content/IIntentReceiver$Stub;->()V -Landroid/content/IIntentReceiver;->performReceive(Landroid/content/Intent;ILjava/lang/String;Landroid/os/Bundle;ZZI)V Landroid/content/IOnPrimaryClipChangedListener$Stub;->()V Landroid/content/IOnPrimaryClipChangedListener$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/IOnPrimaryClipChangedListener; Landroid/content/IRestrictionsManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/IRestrictionsManager; @@ -307,29 +277,20 @@ Landroid/content/ISyncAdapter$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/content/ISyncAdapter$Stub$Proxy;->mRemote:Landroid/os/IBinder; Landroid/content/ISyncAdapter$Stub;->()V Landroid/content/ISyncAdapter$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/ISyncAdapter; -Landroid/content/ISyncAdapter;->cancelSync(Landroid/content/ISyncContext;)V -Landroid/content/ISyncAdapter;->onUnsyncableAccount(Landroid/content/ISyncAdapterUnsyncableAccountCallback;)V -Landroid/content/ISyncAdapter;->startSync(Landroid/content/ISyncContext;Ljava/lang/String;Landroid/accounts/Account;Landroid/os/Bundle;)V Landroid/content/ISyncContext$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/content/ISyncContext$Stub$Proxy;->mRemote:Landroid/os/IBinder; Landroid/content/ISyncContext$Stub;->()V Landroid/content/ISyncContext$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/ISyncContext; Landroid/content/ISyncServiceAdapter$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/ISyncServiceAdapter; -Landroid/content/ISyncServiceAdapter;->cancelSync(Landroid/content/ISyncContext;)V -Landroid/content/ISyncServiceAdapter;->startSync(Landroid/content/ISyncContext;Landroid/os/Bundle;)V Landroid/content/ISyncStatusObserver$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/content/ISyncStatusObserver$Stub$Proxy;->mRemote:Landroid/os/IBinder; Landroid/content/ISyncStatusObserver$Stub;->()V Landroid/content/ISyncStatusObserver$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/ISyncStatusObserver; -Landroid/content/ISyncStatusObserver;->onStatusChanged(I)V Landroid/content/om/IOverlayManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/om/IOverlayManager; -Landroid/content/om/IOverlayManager;->getAllOverlays(I)Ljava/util/Map; -Landroid/content/om/IOverlayManager;->getOverlayInfo(Ljava/lang/String;I)Landroid/content/om/OverlayInfo; Landroid/content/pm/IPackageDataObserver$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/content/pm/IPackageDataObserver$Stub$Proxy;->mRemote:Landroid/os/IBinder; Landroid/content/pm/IPackageDataObserver$Stub;->()V Landroid/content/pm/IPackageDataObserver$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageDataObserver; -Landroid/content/pm/IPackageDataObserver;->onRemoveCompleted(Ljava/lang/String;Z)V Landroid/content/pm/IPackageDeleteObserver$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/content/pm/IPackageDeleteObserver$Stub;->()V Landroid/content/pm/IPackageDeleteObserver$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageDeleteObserver; @@ -337,17 +298,9 @@ Landroid/content/pm/IPackageDeleteObserver2$Stub$Proxy;->(Landroid/os/IBin Landroid/content/pm/IPackageDeleteObserver2$Stub$Proxy;->mRemote:Landroid/os/IBinder; Landroid/content/pm/IPackageDeleteObserver2$Stub;->()V Landroid/content/pm/IPackageDeleteObserver2$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageDeleteObserver2; -Landroid/content/pm/IPackageDeleteObserver2;->onPackageDeleted(Ljava/lang/String;ILjava/lang/String;)V -Landroid/content/pm/IPackageDeleteObserver;->packageDeleted(Ljava/lang/String;I)V -Landroid/content/pm/IPackageInstaller;->uninstall(Landroid/content/pm/VersionedPackage;Ljava/lang/String;ILandroid/content/IntentSender;I)V Landroid/content/pm/IPackageInstallerCallback$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/content/pm/IPackageInstallerCallback$Stub$Proxy;->mRemote:Landroid/os/IBinder; Landroid/content/pm/IPackageInstallerCallback$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageInstallerCallback; -Landroid/content/pm/IPackageInstallerCallback;->onSessionActiveChanged(IZ)V -Landroid/content/pm/IPackageInstallerCallback;->onSessionBadgingChanged(I)V -Landroid/content/pm/IPackageInstallerCallback;->onSessionCreated(I)V -Landroid/content/pm/IPackageInstallerCallback;->onSessionFinished(IZ)V -Landroid/content/pm/IPackageInstallerCallback;->onSessionProgressChanged(IF)V Landroid/content/pm/IPackageInstallerSession$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/content/pm/IPackageInstallerSession$Stub$Proxy;->mRemote:Landroid/os/IBinder; Landroid/content/pm/IPackageInstallerSession$Stub;->()V @@ -356,8 +309,6 @@ Landroid/content/pm/IPackageInstallObserver2$Stub$Proxy;->(Landroid/os/IBi Landroid/content/pm/IPackageInstallObserver2$Stub$Proxy;->mRemote:Landroid/os/IBinder; Landroid/content/pm/IPackageInstallObserver2$Stub;->()V Landroid/content/pm/IPackageInstallObserver2$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageInstallObserver2; -Landroid/content/pm/IPackageInstallObserver2;->onPackageInstalled(Ljava/lang/String;ILjava/lang/String;Landroid/os/Bundle;)V -Landroid/content/pm/IPackageInstallObserver2;->onUserActionRequired(Landroid/content/Intent;)V Landroid/content/pm/IPackageManager$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/content/pm/IPackageManager$Stub$Proxy;->checkUidPermission(Ljava/lang/String;I)I Landroid/content/pm/IPackageManager$Stub$Proxy;->getAppOpPermissionPackages(Ljava/lang/String;)[Ljava/lang/String; @@ -369,69 +320,12 @@ Landroid/content/pm/IPackageManager$Stub$Proxy;->getPackagesForUid(I)[Ljava/lang Landroid/content/pm/IPackageManager$Stub$Proxy;->getSystemSharedLibraryNames()[Ljava/lang/String; Landroid/content/pm/IPackageManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageManager; Landroid/content/pm/IPackageManager$Stub;->TRANSACTION_getApplicationInfo:I -Landroid/content/pm/IPackageManager;->addPermission(Landroid/content/pm/PermissionInfo;)Z -Landroid/content/pm/IPackageManager;->addPermissionAsync(Landroid/content/pm/PermissionInfo;)Z -Landroid/content/pm/IPackageManager;->canonicalToCurrentPackageNames([Ljava/lang/String;)[Ljava/lang/String; -Landroid/content/pm/IPackageManager;->checkPermission(Ljava/lang/String;Ljava/lang/String;I)I -Landroid/content/pm/IPackageManager;->checkSignatures(Ljava/lang/String;Ljava/lang/String;)I -Landroid/content/pm/IPackageManager;->checkUidSignatures(II)I -Landroid/content/pm/IPackageManager;->clearPackagePreferredActivities(Ljava/lang/String;)V -Landroid/content/pm/IPackageManager;->currentToCanonicalPackageNames([Ljava/lang/String;)[Ljava/lang/String; -Landroid/content/pm/IPackageManager;->deleteApplicationCacheFiles(Ljava/lang/String;Landroid/content/pm/IPackageDataObserver;)V -Landroid/content/pm/IPackageManager;->getActivityInfo(Landroid/content/ComponentName;II)Landroid/content/pm/ActivityInfo; -Landroid/content/pm/IPackageManager;->getApplicationEnabledSetting(Ljava/lang/String;I)I -Landroid/content/pm/IPackageManager;->getApplicationInfo(Ljava/lang/String;II)Landroid/content/pm/ApplicationInfo; -Landroid/content/pm/IPackageManager;->getAppOpPermissionPackages(Ljava/lang/String;)[Ljava/lang/String; -Landroid/content/pm/IPackageManager;->getBlockUninstallForUser(Ljava/lang/String;I)Z -Landroid/content/pm/IPackageManager;->getComponentEnabledSetting(Landroid/content/ComponentName;I)I -Landroid/content/pm/IPackageManager;->getFlagsForUid(I)I -Landroid/content/pm/IPackageManager;->getHomeActivities(Ljava/util/List;)Landroid/content/ComponentName; -Landroid/content/pm/IPackageManager;->getInstalledApplications(II)Landroid/content/pm/ParceledListSlice; -Landroid/content/pm/IPackageManager;->getInstalledPackages(II)Landroid/content/pm/ParceledListSlice; -Landroid/content/pm/IPackageManager;->getInstallerPackageName(Ljava/lang/String;)Ljava/lang/String; -Landroid/content/pm/IPackageManager;->getInstallLocation()I -Landroid/content/pm/IPackageManager;->getInstrumentationInfo(Landroid/content/ComponentName;I)Landroid/content/pm/InstrumentationInfo; -Landroid/content/pm/IPackageManager;->getLastChosenActivity(Landroid/content/Intent;Ljava/lang/String;I)Landroid/content/pm/ResolveInfo; -Landroid/content/pm/IPackageManager;->getNameForUid(I)Ljava/lang/String; -Landroid/content/pm/IPackageManager;->getPackageInfo(Ljava/lang/String;II)Landroid/content/pm/PackageInfo; -Landroid/content/pm/IPackageManager;->getPackageInstaller()Landroid/content/pm/IPackageInstaller; -Landroid/content/pm/IPackageManager;->getPackagesForUid(I)[Ljava/lang/String; -Landroid/content/pm/IPackageManager;->getPackageUid(Ljava/lang/String;II)I -Landroid/content/pm/IPackageManager;->getPermissionControllerPackageName()Ljava/lang/String; -Landroid/content/pm/IPackageManager;->getPermissionGroupInfo(Ljava/lang/String;I)Landroid/content/pm/PermissionGroupInfo; -Landroid/content/pm/IPackageManager;->getPreferredActivities(Ljava/util/List;Ljava/util/List;Ljava/lang/String;)I -Landroid/content/pm/IPackageManager;->getProviderInfo(Landroid/content/ComponentName;II)Landroid/content/pm/ProviderInfo; -Landroid/content/pm/IPackageManager;->getReceiverInfo(Landroid/content/ComponentName;II)Landroid/content/pm/ActivityInfo; -Landroid/content/pm/IPackageManager;->getServiceInfo(Landroid/content/ComponentName;II)Landroid/content/pm/ServiceInfo; -Landroid/content/pm/IPackageManager;->getServicesSystemSharedLibraryPackageName()Ljava/lang/String; -Landroid/content/pm/IPackageManager;->getSharedSystemSharedLibraryPackageName()Ljava/lang/String; -Landroid/content/pm/IPackageManager;->getSystemSharedLibraryNames()[Ljava/lang/String; -Landroid/content/pm/IPackageManager;->getUidForSharedUser(Ljava/lang/String;)I -Landroid/content/pm/IPackageManager;->grantRuntimePermission(Ljava/lang/String;Ljava/lang/String;I)V -Landroid/content/pm/IPackageManager;->hasSystemUidErrors()Z -Landroid/content/pm/IPackageManager;->isPackageAvailable(Ljava/lang/String;I)Z -Landroid/content/pm/IPackageManager;->isSafeMode()Z -Landroid/content/pm/IPackageManager;->isStorageLow()Z -Landroid/content/pm/IPackageManager;->isUidPrivileged(I)Z -Landroid/content/pm/IPackageManager;->queryInstrumentation(Ljava/lang/String;I)Landroid/content/pm/ParceledListSlice; -Landroid/content/pm/IPackageManager;->queryIntentActivities(Landroid/content/Intent;Ljava/lang/String;II)Landroid/content/pm/ParceledListSlice; -Landroid/content/pm/IPackageManager;->querySyncProviders(Ljava/util/List;Ljava/util/List;)V -Landroid/content/pm/IPackageManager;->removePermission(Ljava/lang/String;)V -Landroid/content/pm/IPackageManager;->replacePreferredActivity(Landroid/content/IntentFilter;I[Landroid/content/ComponentName;Landroid/content/ComponentName;I)V -Landroid/content/pm/IPackageManager;->resolveIntent(Landroid/content/Intent;Ljava/lang/String;II)Landroid/content/pm/ResolveInfo; -Landroid/content/pm/IPackageManager;->setApplicationEnabledSetting(Ljava/lang/String;IIILjava/lang/String;)V -Landroid/content/pm/IPackageManager;->setApplicationHiddenSettingAsUser(Ljava/lang/String;ZI)Z -Landroid/content/pm/IPackageManager;->setComponentEnabledSetting(Landroid/content/ComponentName;III)V -Landroid/content/pm/IPackageManager;->setInstallerPackageName(Ljava/lang/String;Ljava/lang/String;)V -Landroid/content/pm/IPackageManager;->setLastChosenActivity(Landroid/content/Intent;Ljava/lang/String;ILandroid/content/IntentFilter;ILandroid/content/ComponentName;)V -Landroid/content/pm/IPackageManager;->setPackageStoppedState(Ljava/lang/String;ZI)V Landroid/content/pm/IPackageMoveObserver$Stub;->()V Landroid/content/pm/IPackageMoveObserver$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageMoveObserver; Landroid/content/pm/IPackageStatsObserver$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/content/pm/IPackageStatsObserver$Stub$Proxy;->mRemote:Landroid/os/IBinder; Landroid/content/pm/IPackageStatsObserver$Stub;->()V Landroid/content/pm/IPackageStatsObserver$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageStatsObserver; -Landroid/content/pm/IPackageStatsObserver;->onGetStatsCompleted(Landroid/content/pm/PackageStats;Z)V Landroid/content/pm/IShortcutService$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/content/pm/IShortcutService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IShortcutService; Landroid/content/res/ConfigurationBoundResourceCache;->()V diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl index 9478a3c83d2..3c389e4aa38 100644 --- a/core/java/android/app/admin/IDevicePolicyManager.aidl +++ b/core/java/android/app/admin/IDevicePolicyManager.aidl @@ -124,6 +124,7 @@ interface IDevicePolicyManager { void setActiveAdmin(in ComponentName policyReceiver, boolean refreshing, int userHandle); boolean isAdminActive(in ComponentName policyReceiver, int userHandle); List getActiveAdmins(int userHandle); + @UnsupportedAppUsage boolean packageHasActiveAdmins(String packageName, int userHandle); void getRemoveWarning(in ComponentName policyReceiver, in RemoteCallback result, int userHandle); void removeActiveAdmin(in ComponentName policyReceiver, int userHandle); diff --git a/core/java/android/app/backup/IBackupManager.aidl b/core/java/android/app/backup/IBackupManager.aidl index 8386c72e340..70ecdae9265 100644 --- a/core/java/android/app/backup/IBackupManager.aidl +++ b/core/java/android/app/backup/IBackupManager.aidl @@ -54,6 +54,7 @@ interface IBackupManager { /** * {@link android.app.backup.IBackupManager.dataChangedForUser} for the calling user id. */ + @UnsupportedAppUsage void dataChanged(String packageName); /** @@ -73,6 +74,7 @@ interface IBackupManager { /** * {@link android.app.backup.IBackupManager.clearBackupDataForUser} for the calling user id. */ + @UnsupportedAppUsage void clearBackupData(String transportName, String packageName); /** @@ -155,6 +157,7 @@ interface IBackupManager { /** * {@link android.app.backup.IBackupManager.setBackupEnabledForUser} for the calling user id. */ + @UnsupportedAppUsage void setBackupEnabled(boolean isEnabled); /** @@ -178,6 +181,7 @@ interface IBackupManager { /** * {@link android.app.backup.IBackupManager.setAutoRestoreForUser} for the calling user id. */ + @UnsupportedAppUsage void setAutoRestore(boolean doAutoRestore); /** @@ -194,6 +198,7 @@ interface IBackupManager { /** * {@link android.app.backup.IBackupManager.isBackupEnabledForUser} for the calling user id. */ + @UnsupportedAppUsage boolean isBackupEnabled(); /** @@ -322,6 +327,7 @@ interface IBackupManager { * {@link android.app.backup.IBackupManager.acknowledgeFullBackupOrRestoreForUser} for the * calling user id. */ + @UnsupportedAppUsage void acknowledgeFullBackupOrRestore(int token, boolean allow, in String curPassword, in String encryptionPassword, IFullBackupRestoreObserver observer); @@ -371,6 +377,7 @@ interface IBackupManager { /** * {@link android.app.backup.IBackupManager.getCurrentTransportForUser} for the calling user id. */ + @UnsupportedAppUsage String getCurrentTransport(); /** @@ -397,6 +404,7 @@ interface IBackupManager { /** * {@link android.app.backup.IBackupManager.listAllTransportsForUser} for the calling user id. */ + @UnsupportedAppUsage String[] listAllTransports(); /** @@ -434,6 +442,7 @@ interface IBackupManager { * {@link android.app.backup.IBackupManager.selectBackupTransportForUser} for the calling user * id. */ + @UnsupportedAppUsage String selectBackupTransport(String transport); /** @@ -590,6 +599,7 @@ interface IBackupManager { * @param whichUser User handle of the defined user whose backup active state * is being queried. */ + @UnsupportedAppUsage boolean isBackupServiceActive(int whichUser); /** diff --git a/core/java/android/app/job/IJobCallback.aidl b/core/java/android/app/job/IJobCallback.aidl index e7695e2e747..d281da037fd 100644 --- a/core/java/android/app/job/IJobCallback.aidl +++ b/core/java/android/app/job/IJobCallback.aidl @@ -36,6 +36,7 @@ interface IJobCallback { * @param ongoing True to indicate that the client is processing the job. False if the job is * complete */ + @UnsupportedAppUsage void acknowledgeStartMessage(int jobId, boolean ongoing); /** * Immediate callback to the system after sending a stop signal, used to quickly detect ANR. @@ -43,14 +44,17 @@ interface IJobCallback { * @param jobId Unique integer used to identify this job. * @param reschedule Whether or not to reschedule this job. */ + @UnsupportedAppUsage void acknowledgeStopMessage(int jobId, boolean reschedule); /* * Called to deqeue next work item for the job. */ + @UnsupportedAppUsage JobWorkItem dequeueWork(int jobId); /* * Called to report that job has completed processing a work item. */ + @UnsupportedAppUsage boolean completeWork(int jobId, int workId); /* * Tell the job manager that the client is done with its execution, so that it can go on to @@ -59,5 +63,6 @@ interface IJobCallback { * @param jobId Unique integer used to identify this job. * @param reschedule Whether or not to reschedule this job. */ + @UnsupportedAppUsage void jobFinished(int jobId, boolean reschedule); } diff --git a/core/java/android/app/job/IJobService.aidl b/core/java/android/app/job/IJobService.aidl index 7f55d29e87e..22ad252b963 100644 --- a/core/java/android/app/job/IJobService.aidl +++ b/core/java/android/app/job/IJobService.aidl @@ -26,7 +26,9 @@ import android.app.job.JobParameters; */ oneway interface IJobService { /** Begin execution of application's job. */ + @UnsupportedAppUsage void startJob(in JobParameters jobParams); /** Stop execution of application's job. */ + @UnsupportedAppUsage void stopJob(in JobParameters jobParams); } diff --git a/core/java/android/app/usage/IUsageStatsManager.aidl b/core/java/android/app/usage/IUsageStatsManager.aidl index b1500c19382..b72ec39a554 100644 --- a/core/java/android/app/usage/IUsageStatsManager.aidl +++ b/core/java/android/app/usage/IUsageStatsManager.aidl @@ -28,8 +28,10 @@ import java.util.Map; * {@hide} */ interface IUsageStatsManager { + @UnsupportedAppUsage ParceledListSlice queryUsageStats(int bucketType, long beginTime, long endTime, String callingPackage); + @UnsupportedAppUsage ParceledListSlice queryConfigurationStats(int bucketType, long beginTime, long endTime, String callingPackage); ParceledListSlice queryEventStats(int bucketType, long beginTime, long endTime, @@ -38,7 +40,9 @@ interface IUsageStatsManager { UsageEvents queryEventsForPackage(long beginTime, long endTime, String callingPackage); UsageEvents queryEventsForUser(long beginTime, long endTime, int userId, String callingPackage); UsageEvents queryEventsForPackageForUser(long beginTime, long endTime, int userId, String pkg, String callingPackage); + @UnsupportedAppUsage void setAppInactive(String packageName, boolean inactive, int userId); + @UnsupportedAppUsage boolean isAppInactive(String packageName, int userId); void whitelistAppTemporarily(String packageName, long duration, int userId); void onCarrierPrivilegedAppsChanged(); diff --git a/core/java/android/content/ContentProviderNative.java b/core/java/android/content/ContentProviderNative.java index ca657b150f9..994833866f4 100644 --- a/core/java/android/content/ContentProviderNative.java +++ b/core/java/android/content/ContentProviderNative.java @@ -800,5 +800,6 @@ final class ContentProviderProxy implements IContentProvider } } + @UnsupportedAppUsage private IBinder mRemote; } diff --git a/core/java/android/content/IContentService.aidl b/core/java/android/content/IContentService.aidl index 9f6e236306e..a34a9951671 100644 --- a/core/java/android/content/IContentService.aidl +++ b/core/java/android/content/IContentService.aidl @@ -61,6 +61,7 @@ interface IContentService { */ void sync(in SyncRequest request, String callingPackage); void syncAsUser(in SyncRequest request, int userId, String callingPackage); + @UnsupportedAppUsage void cancelSync(in Account account, String authority, in ComponentName cname); void cancelSyncAsUser(in Account account, String authority, in ComponentName cname, int userId); @@ -118,6 +119,7 @@ interface IContentService { * Check if this account/provider is syncable. * @return >0 if it is syncable, 0 if not, and <0 if the state isn't known yet. */ + @UnsupportedAppUsage int getIsSyncable(in Account account, String providerName); int getIsSyncableAsUser(in Account account, String providerName, int userId); @@ -128,9 +130,11 @@ interface IContentService { void setIsSyncable(in Account account, String providerName, int syncable); void setIsSyncableAsUser(in Account account, String providerName, int syncable, int userId); + @UnsupportedAppUsage void setMasterSyncAutomatically(boolean flag); void setMasterSyncAutomaticallyAsUser(boolean flag, int userId); + @UnsupportedAppUsage boolean getMasterSyncAutomatically(); boolean getMasterSyncAutomaticallyAsUser(int userId); @@ -141,6 +145,7 @@ interface IContentService { * Returns the types of the SyncAdapters that are registered with the system. * @return Returns the types of the SyncAdapters that are registered with the system. */ + @UnsupportedAppUsage SyncAdapterType[] getSyncAdapterTypes(); SyncAdapterType[] getSyncAdapterTypesAsUser(int userId); @@ -154,6 +159,7 @@ interface IContentService { * @param cname component to identify sync service, must be null if account/providerName are * non-null. */ + @UnsupportedAppUsage boolean isSyncActive(in Account account, String authority, in ComponentName cname); /** diff --git a/core/java/android/content/IIntentReceiver.aidl b/core/java/android/content/IIntentReceiver.aidl index 3d9272388e0..2b45021db90 100644 --- a/core/java/android/content/IIntentReceiver.aidl +++ b/core/java/android/content/IIntentReceiver.aidl @@ -27,6 +27,7 @@ import android.os.Bundle; * {@hide} */ oneway interface IIntentReceiver { + @UnsupportedAppUsage void performReceive(in Intent intent, int resultCode, String data, in Bundle extras, boolean ordered, boolean sticky, int sendingUser); } diff --git a/core/java/android/content/ISyncAdapter.aidl b/core/java/android/content/ISyncAdapter.aidl index 0eb581e6b58..9242d0289cf 100644 --- a/core/java/android/content/ISyncAdapter.aidl +++ b/core/java/android/content/ISyncAdapter.aidl @@ -32,6 +32,7 @@ oneway interface ISyncAdapter { * * @param cb If called back with {@code false} accounts are not synced. */ + @UnsupportedAppUsage void onUnsyncableAccount(ISyncAdapterUnsyncableAccountCallback cb); /** @@ -44,6 +45,7 @@ oneway interface ISyncAdapter { * @param account the account that should be synced * @param extras SyncAdapter-specific parameters */ + @UnsupportedAppUsage void startSync(ISyncContext syncContext, String authority, in Account account, in Bundle extras); @@ -52,5 +54,6 @@ oneway interface ISyncAdapter { * after the ISyncContext.onFinished() for that sync was called. * @param syncContext the ISyncContext that was passed to {@link #startSync} */ + @UnsupportedAppUsage void cancelSync(ISyncContext syncContext); } diff --git a/core/java/android/content/ISyncServiceAdapter.aidl b/core/java/android/content/ISyncServiceAdapter.aidl index d419307e7fa..29f3a406e5a 100644 --- a/core/java/android/content/ISyncServiceAdapter.aidl +++ b/core/java/android/content/ISyncServiceAdapter.aidl @@ -35,11 +35,13 @@ oneway interface ISyncServiceAdapter { * @param extras SyncAdapter-specific parameters. * */ + @UnsupportedAppUsage void startSync(ISyncContext syncContext, in Bundle extras); /** * Cancel the currently ongoing sync. */ + @UnsupportedAppUsage void cancelSync(ISyncContext syncContext); } diff --git a/core/java/android/content/ISyncStatusObserver.aidl b/core/java/android/content/ISyncStatusObserver.aidl index eb2684544ab..64bf3bd355e 100644 --- a/core/java/android/content/ISyncStatusObserver.aidl +++ b/core/java/android/content/ISyncStatusObserver.aidl @@ -20,5 +20,6 @@ package android.content; * @hide */ oneway interface ISyncStatusObserver { + @UnsupportedAppUsage void onStatusChanged(int which); } diff --git a/core/java/android/content/om/IOverlayManager.aidl b/core/java/android/content/om/IOverlayManager.aidl index 5b3c9dd9337..722c128c050 100644 --- a/core/java/android/content/om/IOverlayManager.aidl +++ b/core/java/android/content/om/IOverlayManager.aidl @@ -37,6 +37,7 @@ interface IOverlayManager { * mapped to lists of overlays; if no overlays exist for the * requested user, an empty map is returned. */ + @UnsupportedAppUsage Map getAllOverlays(in int userId); /** @@ -60,6 +61,7 @@ interface IOverlayManager { * @return The OverlayInfo for the overlay package; or null if no such * overlay package exists. */ + @UnsupportedAppUsage OverlayInfo getOverlayInfo(in String packageName, in int userId); /** diff --git a/core/java/android/content/pm/IPackageDataObserver.aidl b/core/java/android/content/pm/IPackageDataObserver.aidl index d010ee43275..926ecda04ba 100644 --- a/core/java/android/content/pm/IPackageDataObserver.aidl +++ b/core/java/android/content/pm/IPackageDataObserver.aidl @@ -24,5 +24,6 @@ package android.content.pm; * {@hide} */ oneway interface IPackageDataObserver { + @UnsupportedAppUsage void onRemoveCompleted(in String packageName, boolean succeeded); } diff --git a/core/java/android/content/pm/IPackageDeleteObserver.aidl b/core/java/android/content/pm/IPackageDeleteObserver.aidl index 2e2d16ebd7f..faae81e3254 100644 --- a/core/java/android/content/pm/IPackageDeleteObserver.aidl +++ b/core/java/android/content/pm/IPackageDeleteObserver.aidl @@ -23,6 +23,7 @@ package android.content.pm; * {@hide} */ oneway interface IPackageDeleteObserver { + @UnsupportedAppUsage void packageDeleted(in String packageName, in int returnCode); } diff --git a/core/java/android/content/pm/IPackageDeleteObserver2.aidl b/core/java/android/content/pm/IPackageDeleteObserver2.aidl index bff3baa5576..ea8096755e5 100644 --- a/core/java/android/content/pm/IPackageDeleteObserver2.aidl +++ b/core/java/android/content/pm/IPackageDeleteObserver2.aidl @@ -21,5 +21,6 @@ import android.content.Intent; /** {@hide} */ oneway interface IPackageDeleteObserver2 { void onUserActionRequired(in Intent intent); + @UnsupportedAppUsage void onPackageDeleted(String packageName, int returnCode, String msg); } diff --git a/core/java/android/content/pm/IPackageInstallObserver2.aidl b/core/java/android/content/pm/IPackageInstallObserver2.aidl index bb5f22a2faa..ed2eb7dceff 100644 --- a/core/java/android/content/pm/IPackageInstallObserver2.aidl +++ b/core/java/android/content/pm/IPackageInstallObserver2.aidl @@ -25,6 +25,7 @@ import android.os.Bundle; * @hide */ oneway interface IPackageInstallObserver2 { + @UnsupportedAppUsage void onUserActionRequired(in Intent intent); /** @@ -42,5 +43,6 @@ oneway interface IPackageInstallObserver2 { * * */ + @UnsupportedAppUsage void onPackageInstalled(String basePackageName, int returnCode, String msg, in Bundle extras); } diff --git a/core/java/android/content/pm/IPackageInstaller.aidl b/core/java/android/content/pm/IPackageInstaller.aidl index 0cf83fd4655..8e840796e95 100644 --- a/core/java/android/content/pm/IPackageInstaller.aidl +++ b/core/java/android/content/pm/IPackageInstaller.aidl @@ -47,6 +47,7 @@ interface IPackageInstaller { void registerCallback(IPackageInstallerCallback callback, int userId); void unregisterCallback(IPackageInstallerCallback callback); + @UnsupportedAppUsage void uninstall(in VersionedPackage versionedPackage, String callerPackageName, int flags, in IntentSender statusReceiver, int userId); diff --git a/core/java/android/content/pm/IPackageInstallerCallback.aidl b/core/java/android/content/pm/IPackageInstallerCallback.aidl index 974eb1ede5b..ee265007b39 100644 --- a/core/java/android/content/pm/IPackageInstallerCallback.aidl +++ b/core/java/android/content/pm/IPackageInstallerCallback.aidl @@ -18,9 +18,14 @@ package android.content.pm; /** {@hide} */ oneway interface IPackageInstallerCallback { + @UnsupportedAppUsage void onSessionCreated(int sessionId); + @UnsupportedAppUsage void onSessionBadgingChanged(int sessionId); + @UnsupportedAppUsage void onSessionActiveChanged(int sessionId, boolean active); + @UnsupportedAppUsage void onSessionProgressChanged(int sessionId, float progress); + @UnsupportedAppUsage void onSessionFinished(int sessionId, boolean success); } diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl index dcbb4ac2d5f..fd3529b05c3 100644 --- a/core/java/android/content/pm/IPackageManager.aidl +++ b/core/java/android/content/pm/IPackageManager.aidl @@ -63,45 +63,60 @@ import android.content.IntentSender; */ interface IPackageManager { void checkPackageStartable(String packageName, int userId); + @UnsupportedAppUsage boolean isPackageAvailable(String packageName, int userId); + @UnsupportedAppUsage PackageInfo getPackageInfo(String packageName, int flags, int userId); PackageInfo getPackageInfoVersioned(in VersionedPackage versionedPackage, int flags, int userId); + @UnsupportedAppUsage int getPackageUid(String packageName, int flags, int userId); int[] getPackageGids(String packageName, int flags, int userId); + @UnsupportedAppUsage String[] currentToCanonicalPackageNames(in String[] names); + @UnsupportedAppUsage String[] canonicalToCurrentPackageNames(in String[] names); PermissionInfo getPermissionInfo(String name, String packageName, int flags); ParceledListSlice queryPermissionsByGroup(String group, int flags); + @UnsupportedAppUsage PermissionGroupInfo getPermissionGroupInfo(String name, int flags); ParceledListSlice getAllPermissionGroups(int flags); + @UnsupportedAppUsage ApplicationInfo getApplicationInfo(String packageName, int flags ,int userId); + @UnsupportedAppUsage ActivityInfo getActivityInfo(in ComponentName className, int flags, int userId); boolean activitySupportsIntent(in ComponentName className, in Intent intent, String resolvedType); + @UnsupportedAppUsage ActivityInfo getReceiverInfo(in ComponentName className, int flags, int userId); + @UnsupportedAppUsage ServiceInfo getServiceInfo(in ComponentName className, int flags, int userId); + @UnsupportedAppUsage ProviderInfo getProviderInfo(in ComponentName className, int flags, int userId); + @UnsupportedAppUsage int checkPermission(String permName, String pkgName, int userId); int checkUidPermission(String permName, int uid); + @UnsupportedAppUsage boolean addPermission(in PermissionInfo info); + @UnsupportedAppUsage void removePermission(String name); + @UnsupportedAppUsage void grantRuntimePermission(String packageName, String permissionName, int userId); void revokeRuntimePermission(String packageName, String permissionName, int userId); @@ -120,33 +135,43 @@ interface IPackageManager { boolean isProtectedBroadcast(String actionName); + @UnsupportedAppUsage int checkSignatures(String pkg1, String pkg2); + @UnsupportedAppUsage int checkUidSignatures(int uid1, int uid2); List getAllPackages(); + @UnsupportedAppUsage String[] getPackagesForUid(int uid); + @UnsupportedAppUsage String getNameForUid(int uid); String[] getNamesForUids(in int[] uids); + @UnsupportedAppUsage int getUidForSharedUser(String sharedUserName); + @UnsupportedAppUsage int getFlagsForUid(int uid); int getPrivateFlagsForUid(int uid); + @UnsupportedAppUsage boolean isUidPrivileged(int uid); + @UnsupportedAppUsage String[] getAppOpPermissionPackages(String permissionName); + @UnsupportedAppUsage ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags, int userId); ResolveInfo findPersistentPreferredActivity(in Intent intent, int userId); boolean canForwardTo(in Intent intent, String resolvedType, int sourceUserId, int targetUserId); + @UnsupportedAppUsage ParceledListSlice queryIntentActivities(in Intent intent, String resolvedType, int flags, int userId); @@ -173,6 +198,7 @@ interface IPackageManager { * limit that kicks in when flags are included that bloat up the data * returned. */ + @UnsupportedAppUsage ParceledListSlice getInstalledPackages(int flags, in int userId); /** @@ -190,6 +216,7 @@ interface IPackageManager { * limit that kicks in when flags are included that bloat up the data * returned. */ + @UnsupportedAppUsage ParceledListSlice getInstalledApplications(int flags, int userId); /** @@ -210,20 +237,24 @@ interface IPackageManager { * @param outInfo Filled in with a list of the ProviderInfo for each * name in 'outNames'. */ + @UnsupportedAppUsage void querySyncProviders(inout List outNames, inout List outInfo); ParceledListSlice queryContentProviders( String processName, int uid, int flags, String metaDataKey); + @UnsupportedAppUsage InstrumentationInfo getInstrumentationInfo( in ComponentName className, int flags); + @UnsupportedAppUsage ParceledListSlice queryInstrumentation( String targetPackage, int flags); void finishPackageInstall(int token, boolean didLaunch); + @UnsupportedAppUsage void setInstallerPackageName(in String targetPackage, in String installerPackageName); void setApplicationCategoryHint(String packageName, int categoryHint, String callerPackageName); @@ -243,24 +274,30 @@ interface IPackageManager { void deletePackageVersioned(in VersionedPackage versionedPackage, IPackageDeleteObserver2 observer, int userId, int flags); + @UnsupportedAppUsage String getInstallerPackageName(in String packageName); void resetApplicationPreferences(int userId); + @UnsupportedAppUsage ResolveInfo getLastChosenActivity(in Intent intent, String resolvedType, int flags); + @UnsupportedAppUsage void setLastChosenActivity(in Intent intent, String resolvedType, int flags, in IntentFilter filter, int match, in ComponentName activity); void addPreferredActivity(in IntentFilter filter, int match, in ComponentName[] set, in ComponentName activity, int userId); + @UnsupportedAppUsage void replacePreferredActivity(in IntentFilter filter, int match, in ComponentName[] set, in ComponentName activity, int userId); + @UnsupportedAppUsage void clearPackagePreferredActivities(String packageName); + @UnsupportedAppUsage int getPreferredActivities(out List outFilters, out List outActivities, String packageName); @@ -300,6 +337,7 @@ interface IPackageManager { * Report the set of 'Home' activity candidates, plus (if any) which of them * is the current "always use this one" setting. */ + @UnsupportedAppUsage ComponentName getHomeActivities(out List outHomeCandidates); void setHomeActivity(in ComponentName className, int userId); @@ -307,23 +345,27 @@ interface IPackageManager { /** * As per {@link android.content.pm.PackageManager#setComponentEnabledSetting}. */ + @UnsupportedAppUsage void setComponentEnabledSetting(in ComponentName componentName, in int newState, in int flags, int userId); /** * As per {@link android.content.pm.PackageManager#getComponentEnabledSetting}. */ + @UnsupportedAppUsage int getComponentEnabledSetting(in ComponentName componentName, int userId); /** * As per {@link android.content.pm.PackageManager#setApplicationEnabledSetting}. */ + @UnsupportedAppUsage void setApplicationEnabledSetting(in String packageName, in int newState, int flags, int userId, String callingPackage); /** * As per {@link android.content.pm.PackageManager#getApplicationEnabledSetting}. */ + @UnsupportedAppUsage int getApplicationEnabledSetting(in String packageName, int userId); /** @@ -341,6 +383,7 @@ interface IPackageManager { * Set whether the given package should be considered stopped, making * it not visible to implicit intents that filter out stopped packages. */ + @UnsupportedAppUsage void setPackageStoppedState(String packageName, boolean stopped, int userId); /** @@ -396,6 +439,7 @@ interface IPackageManager { * files need to be deleted * @param observer a callback used to notify when the deletion is finished. */ + @UnsupportedAppUsage void deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer); /** @@ -436,6 +480,7 @@ interface IPackageManager { * Get a list of shared libraries that are available on the * system. */ + @UnsupportedAppUsage String[] getSystemSharedLibraryNames(); /** @@ -447,8 +492,10 @@ interface IPackageManager { boolean hasSystemFeature(String name, int version); void enterSafeMode(); + @UnsupportedAppUsage boolean isSafeMode(); void systemReady(); + @UnsupportedAppUsage boolean hasSystemUidErrors(); /** @@ -570,9 +617,11 @@ interface IPackageManager { int movePackage(in String packageName, in String volumeUuid); int movePrimaryStorage(in String volumeUuid); + @UnsupportedAppUsage boolean addPermissionAsync(in PermissionInfo info); boolean setInstallLocation(int loc); + @UnsupportedAppUsage int getInstallLocation(); int installExistingPackageAsUser(String packageName, int userId, int installFlags, @@ -600,17 +649,21 @@ interface IPackageManager { boolean isPermissionEnforced(String permission); /** Reflects current DeviceStorageMonitorService state */ + @UnsupportedAppUsage boolean isStorageLow(); + @UnsupportedAppUsage boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden, int userId); boolean getApplicationHiddenSettingAsUser(String packageName, int userId); void setSystemAppHiddenUntilInstalled(String packageName, boolean hidden); boolean setSystemAppInstallState(String packageName, boolean installed, int userId); + @UnsupportedAppUsage IPackageInstaller getPackageInstaller(); boolean setBlockUninstallForUser(String packageName, boolean blockUninstall, int userId); + @UnsupportedAppUsage boolean getBlockUninstallForUser(String packageName, int userId); KeySet getKeySetByAlias(String packageName, String alias); @@ -631,6 +684,7 @@ interface IPackageManager { boolean isPermissionRevokedByPolicy(String permission, String packageName, int userId); + @UnsupportedAppUsage String getPermissionControllerPackageName(); ParceledListSlice getInstantApps(int userId); @@ -647,7 +701,9 @@ interface IPackageManager { */ void setUpdateAvailable(String packageName, boolean updateAvaialble); + @UnsupportedAppUsage String getServicesSystemSharedLibraryPackageName(); + @UnsupportedAppUsage String getSharedSystemSharedLibraryPackageName(); ChangedPackages getChangedPackages(int sequenceNumber, int userId); diff --git a/core/java/android/content/pm/IPackageStatsObserver.aidl b/core/java/android/content/pm/IPackageStatsObserver.aidl index ede4d1d9a79..559a0355de1 100644 --- a/core/java/android/content/pm/IPackageStatsObserver.aidl +++ b/core/java/android/content/pm/IPackageStatsObserver.aidl @@ -26,5 +26,6 @@ import android.content.pm.PackageStats; */ oneway interface IPackageStatsObserver { + @UnsupportedAppUsage void onGetStatsCompleted(in PackageStats pStats, boolean succeeded); } -- GitLab From 6dcbee6671a7c3b6e19299e3c18ff0c451afc438 Mon Sep 17 00:00:00 2001 From: Tiger Huang Date: Wed, 20 Feb 2019 21:45:55 +0800 Subject: [PATCH 039/398] Not to show intermediate screen to the user when dismissing split screen During dismissing split screen mode, the logic may perform some surface operations. e.g., setWindowCrop and hide. If we clear the crop of an app stack first and then hide the app a few milliseconds later, the user may see the screen flash. This CL uses inSurfaceTransaction to ensure that there won't be any intermediate transactions while setting windowing mode. Fix: 79686616 Test: atest WindowManagerSmokeTest Change-Id: Ie35c3422dd0c49b5145a6b80f0b78f23e27a11a1 --- .../core/java/com/android/server/wm/ActivityStack.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java index a4457e291cc..7b81e973318 100644 --- a/services/core/java/com/android/server/wm/ActivityStack.java +++ b/services/core/java/com/android/server/wm/ActivityStack.java @@ -701,6 +701,14 @@ class ActivityStack extends ConfigurationContainer { */ void setWindowingMode(int preferredWindowingMode, boolean animate, boolean showRecents, boolean enteringSplitScreenMode, boolean deferEnsuringVisibility, boolean creating) { + mWindowManager.inSurfaceTransaction(() -> setWindowingModeInSurfaceTransaction( + preferredWindowingMode, animate, showRecents, enteringSplitScreenMode, + deferEnsuringVisibility, creating)); + } + + private void setWindowingModeInSurfaceTransaction(int preferredWindowingMode, boolean animate, + boolean showRecents, boolean enteringSplitScreenMode, boolean deferEnsuringVisibility, + boolean creating) { final int currentMode = getWindowingMode(); final int currentOverrideMode = getRequestedOverrideWindowingMode(); final ActivityDisplay display = getDisplay(); @@ -744,7 +752,7 @@ class ActivityStack extends ConfigurationContainer { // warning toast about it. mService.getTaskChangeNotificationController().notifyActivityDismissingDockedStack(); final ActivityStack primarySplitStack = display.getSplitScreenPrimaryStack(); - primarySplitStack.setWindowingMode(WINDOWING_MODE_UNDEFINED, + primarySplitStack.setWindowingModeInSurfaceTransaction(WINDOWING_MODE_UNDEFINED, false /* animate */, false /* showRecents */, false /* enteringSplitScreenMode */, true /* deferEnsuringVisibility */, primarySplitStack == this ? creating : false); -- GitLab From f16ebd08113fd6060a6420be6a436688bc797211 Mon Sep 17 00:00:00 2001 From: Richard Uhler Date: Wed, 27 Feb 2019 11:18:45 +0000 Subject: [PATCH 040/398] Miscellaneous cleanup in RollbackStore. * Factor out code for reading and writing RollbackInfo from json. * Make methods static where appropriate. * Minor other cleanup. In preparation for having RollbackData reuse RollbackInfo so we don't end up with duplicate copies of PackageRollbackInfo for a rollback so we can fix the bug when doing userdata restore for staged installs. Test: atest RollbackTest Bug: 124044231 Change-Id: I4f579393c1ffe8d519560ed223f61b002d730c50 --- .../server/rollback/RollbackStore.java | 69 ++++++++++--------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/services/core/java/com/android/server/rollback/RollbackStore.java b/services/core/java/com/android/server/rollback/RollbackStore.java index 99e102a2edb..23defadf542 100644 --- a/services/core/java/com/android/server/rollback/RollbackStore.java +++ b/services/core/java/com/android/server/rollback/RollbackStore.java @@ -183,6 +183,25 @@ class RollbackStore { return ceSnapshotInodes; } + private static JSONObject rollbackInfoToJson(RollbackInfo rollback) throws JSONException { + JSONObject json = new JSONObject(); + json.put("rollbackId", rollback.getRollbackId()); + json.put("packages", toJson(rollback.getPackages())); + json.put("isStaged", rollback.isStaged()); + json.put("causePackages", versionedPackagesToJson(rollback.getCausePackages())); + json.put("committedSessionId", rollback.getCommittedSessionId()); + return json; + } + + private static RollbackInfo rollbackInfoFromJson(JSONObject json) throws JSONException { + return new RollbackInfo( + json.getInt("rollbackId"), + packageRollbackInfosFromJson(json.getJSONArray("packages")), + json.getBoolean("isStaged"), + versionedPackagesFromJson(json.getJSONArray("causePackages")), + json.getInt("committedSessionId")); + } + /** * Reads the list of recently executed rollbacks from persistent storage. */ @@ -197,17 +216,7 @@ class RollbackStore { JSONObject object = new JSONObject(jsonString); JSONArray array = object.getJSONArray("recentlyExecuted"); for (int i = 0; i < array.length(); ++i) { - JSONObject element = array.getJSONObject(i); - int rollbackId = element.getInt("rollbackId"); - List packages = packageRollbackInfosFromJson( - element.getJSONArray("packages")); - boolean isStaged = element.getBoolean("isStaged"); - List causePackages = versionedPackagesFromJson( - element.getJSONArray("causePackages")); - int committedSessionId = element.getInt("committedSessionId"); - RollbackInfo rollback = new RollbackInfo(rollbackId, packages, isStaged, - causePackages, committedSessionId); - recentlyExecutedRollbacks.add(rollback); + recentlyExecutedRollbacks.add(rollbackInfoFromJson(array.getJSONObject(i))); } } catch (IOException | JSONException e) { // TODO: What to do here? Surely we shouldn't just forget about @@ -303,13 +312,7 @@ class RollbackStore { for (int i = 0; i < recentlyExecutedRollbacks.size(); ++i) { RollbackInfo rollback = recentlyExecutedRollbacks.get(i); - JSONObject element = new JSONObject(); - element.put("rollbackId", rollback.getRollbackId()); - element.put("packages", toJson(rollback.getPackages())); - element.put("isStaged", rollback.isStaged()); - element.put("causePackages", versionedPackagesToJson(rollback.getCausePackages())); - element.put("committedSessionId", rollback.getCommittedSessionId()); - array.put(element); + array.put(rollbackInfoToJson(rollback)); } PrintWriter pw = new PrintWriter(mRecentlyExecutedRollbacksFile); @@ -325,17 +328,17 @@ class RollbackStore { * Reads the metadata for a rollback from the given directory. * @throws IOException in case of error reading the data. */ - private RollbackData loadRollbackData(File backupDir) throws IOException { + private static RollbackData loadRollbackData(File backupDir) throws IOException { try { File rollbackJsonFile = new File(backupDir, "rollback.json"); JSONObject dataJson = new JSONObject( IoUtils.readFileAsString(rollbackJsonFile.getAbsolutePath())); - int rollbackId = dataJson.getInt("rollbackId"); - int stagedSessionId = dataJson.getInt("stagedSessionId"); - boolean isAvailable = dataJson.getBoolean("isAvailable"); - RollbackData data = new RollbackData(rollbackId, backupDir, - stagedSessionId, isAvailable); + RollbackData data = new RollbackData( + dataJson.getInt("rollbackId"), + backupDir, + dataJson.getInt("stagedSessionId"), + dataJson.getBoolean("isAvailable")); data.packages.addAll(packageRollbackInfosFromJson(dataJson.getJSONArray("packages"))); data.timestamp = Instant.parse(dataJson.getString("timestamp")); data.apkSessionId = dataJson.getInt("apkSessionId"); @@ -346,20 +349,20 @@ class RollbackStore { } } - private JSONObject toJson(VersionedPackage pkg) throws JSONException { + private static JSONObject toJson(VersionedPackage pkg) throws JSONException { JSONObject json = new JSONObject(); json.put("packageName", pkg.getPackageName()); json.put("longVersionCode", pkg.getLongVersionCode()); return json; } - private VersionedPackage versionedPackageFromJson(JSONObject json) throws JSONException { + private static VersionedPackage versionedPackageFromJson(JSONObject json) throws JSONException { String packageName = json.getString("packageName"); long longVersionCode = json.getLong("longVersionCode"); return new VersionedPackage(packageName, longVersionCode); } - private JSONObject toJson(PackageRollbackInfo info) throws JSONException { + private static JSONObject toJson(PackageRollbackInfo info) throws JSONException { JSONObject json = new JSONObject(); json.put("versionRolledBackFrom", toJson(info.getVersionRolledBackFrom())); json.put("versionRolledBackTo", toJson(info.getVersionRolledBackTo())); @@ -378,7 +381,8 @@ class RollbackStore { return json; } - private PackageRollbackInfo packageRollbackInfoFromJson(JSONObject json) throws JSONException { + private static PackageRollbackInfo packageRollbackInfoFromJson(JSONObject json) + throws JSONException { VersionedPackage versionRolledBackFrom = versionedPackageFromJson( json.getJSONObject("versionRolledBackFrom")); VersionedPackage versionRolledBackTo = versionedPackageFromJson( @@ -399,7 +403,7 @@ class RollbackStore { pendingBackups, pendingRestores, isApex, installedUsers, ceSnapshotInodes); } - private JSONArray versionedPackagesToJson(List packages) + private static JSONArray versionedPackagesToJson(List packages) throws JSONException { JSONArray json = new JSONArray(); for (VersionedPackage pkg : packages) { @@ -408,7 +412,8 @@ class RollbackStore { return json; } - private List versionedPackagesFromJson(JSONArray json) throws JSONException { + private static List versionedPackagesFromJson(JSONArray json) + throws JSONException { List packages = new ArrayList<>(); for (int i = 0; i < json.length(); ++i) { packages.add(versionedPackageFromJson(json.getJSONObject(i))); @@ -416,7 +421,7 @@ class RollbackStore { return packages; } - private JSONArray toJson(List infos) throws JSONException { + private static JSONArray toJson(List infos) throws JSONException { JSONArray json = new JSONArray(); for (PackageRollbackInfo info : infos) { json.put(toJson(info)); @@ -424,7 +429,7 @@ class RollbackStore { return json; } - private List packageRollbackInfosFromJson(JSONArray json) + private static List packageRollbackInfosFromJson(JSONArray json) throws JSONException { List infos = new ArrayList<>(); for (int i = 0; i < json.length(); ++i) { -- GitLab From f60a6271ef86ae952c6573fa78b1d86ccb713588 Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Wed, 27 Feb 2019 14:25:59 +0000 Subject: [PATCH 041/398] CastTile: stop active projection (if any) on tile clicks We delegate to the MediaRouteSelector (or picker) dialog only if we determine that a cast session is in progress. Test: Manual Bug: 124753835 Change-Id: I65fdbbd3c9382c1c6db29f8e48350aaf5817807d --- .../android/systemui/qs/tiles/CastTile.java | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java index f05ac4c107e..53503c7544c 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java @@ -21,6 +21,7 @@ import static android.media.MediaRouter.ROUTE_TYPE_REMOTE_DISPLAY; import android.app.Dialog; import android.content.Context; import android.content.Intent; +import android.media.projection.MediaProjectionInfo; import android.provider.Settings; import android.service.quicksettings.Tile; import android.util.Log; @@ -125,7 +126,30 @@ public class CastTile extends QSTileImpl { }); return; } - showDetail(true); + + CastDevice activeProjection = getActiveDeviceMediaProjection(); + if (activeProjection == null) { + showDetail(true); + } else { + mController.stopCasting(activeProjection); + } + } + + private CastDevice getActiveDeviceMediaProjection() { + CastDevice activeDevice = null; + for (CastDevice device : mController.getCastDevices()) { + if (device.state == CastDevice.STATE_CONNECTED + || device.state == CastDevice.STATE_CONNECTING) { + activeDevice = device; + break; + } + } + + if (activeDevice != null && activeDevice.tag instanceof MediaProjectionInfo) { + return activeDevice; + } + + return null; } @Override -- GitLab From f4fb6fb754e48d056fa1aa24bf91b184a11225de Mon Sep 17 00:00:00 2001 From: Andrei Onea Date: Wed, 27 Feb 2019 14:46:52 +0000 Subject: [PATCH 042/398] Add @UnsupportedAppUsage annotations For packages: android.speech android.telephony.mbms.vendor android.view android.webkit This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: Iefe25091fa0fcc0adfe4ff85fe5e3ab3ac9c5f10 --- config/hiddenapi-greylist.txt | 54 ------------------- .../android/speech/IRecognitionListener.aidl | 1 + .../view/IRecentsAnimationController.aidl | 4 ++ .../android/view/IRecentsAnimationRunner.aidl | 2 + .../IRemoteAnimationFinishedCallback.aidl | 1 + .../android/view/IRemoteAnimationRunner.aidl | 2 + core/java/android/view/IWindowManager.aidl | 27 ++++++++++ core/java/android/view/IWindowSession.aidl | 9 ++++ .../java/android/view/RenderNodeAnimator.java | 1 + .../android/webkit/IWebViewUpdateService.aidl | 3 ++ .../mbms/vendor/IMbmsStreamingService.aidl | 4 ++ 11 files changed, 54 insertions(+), 54 deletions(-) diff --git a/config/hiddenapi-greylist.txt b/config/hiddenapi-greylist.txt index e25f463a944..fa5138392fd 100644 --- a/config/hiddenapi-greylist.txt +++ b/config/hiddenapi-greylist.txt @@ -1413,7 +1413,6 @@ Landroid/service/wallpaper/IWallpaperEngine;->dispatchPointer(Landroid/view/Moti Landroid/service/wallpaper/IWallpaperEngine;->dispatchWallpaperCommand(Ljava/lang/String;IIILandroid/os/Bundle;)V Landroid/service/wallpaper/IWallpaperEngine;->setVisibility(Z)V Landroid/service/wallpaper/IWallpaperService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/service/wallpaper/IWallpaperService; -Landroid/speech/IRecognitionListener;->onEvent(ILandroid/os/Bundle;)V Landroid/telecom/Log;->i(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V Landroid/telecom/Log;->w(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V Landroid/telephony/ims/compat/feature/MMTelFeature;->()V @@ -1424,10 +1423,6 @@ Landroid/telephony/JapanesePhoneNumberFormatter;->format(Landroid/text/Editable; Landroid/telephony/mbms/IMbmsStreamingSessionCallback$Stub;->()V Landroid/telephony/mbms/IStreamingServiceCallback$Stub;->()V Landroid/telephony/mbms/vendor/IMbmsStreamingService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/telephony/mbms/vendor/IMbmsStreamingService; -Landroid/telephony/mbms/vendor/IMbmsStreamingService;->getPlaybackUri(ILjava/lang/String;)Landroid/net/Uri; -Landroid/telephony/mbms/vendor/IMbmsStreamingService;->initialize(Landroid/telephony/mbms/IMbmsStreamingSessionCallback;I)I -Landroid/telephony/mbms/vendor/IMbmsStreamingService;->requestUpdateStreamingServices(ILjava/util/List;)I -Landroid/telephony/mbms/vendor/IMbmsStreamingService;->startStreaming(ILjava/lang/String;Landroid/telephony/mbms/IStreamingServiceCallback;)I Landroid/telephony/SmsCbCmasInfo;->getCategory()I Landroid/telephony/SmsCbCmasInfo;->getCertainty()I Landroid/telephony/SmsCbCmasInfo;->getMessageClass()I @@ -1470,17 +1465,8 @@ Landroid/view/autofill/IAutoFillManager$Stub$Proxy;->(Landroid/os/IBinder; Landroid/view/autofill/IAutoFillManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/view/autofill/IAutoFillManager; Landroid/view/IAppTransitionAnimationSpecsFuture$Stub;->()V Landroid/view/IDockedStackListener$Stub;->()V -Landroid/view/IRecentsAnimationController;->finish(Z)V -Landroid/view/IRecentsAnimationController;->screenshotTask(I)Landroid/app/ActivityManager$TaskSnapshot; -Landroid/view/IRecentsAnimationController;->setAnimationTargetsBehindSystemBars(Z)V -Landroid/view/IRecentsAnimationController;->setInputConsumerEnabled(Z)V Landroid/view/IRecentsAnimationRunner$Stub;->()V -Landroid/view/IRecentsAnimationRunner;->onAnimationCanceled()V -Landroid/view/IRecentsAnimationRunner;->onAnimationStart(Landroid/view/IRecentsAnimationController;[Landroid/view/RemoteAnimationTarget;Landroid/graphics/Rect;Landroid/graphics/Rect;)V -Landroid/view/IRemoteAnimationFinishedCallback;->onAnimationFinished()V Landroid/view/IRemoteAnimationRunner$Stub;->()V -Landroid/view/IRemoteAnimationRunner;->onAnimationCancelled()V -Landroid/view/IRemoteAnimationRunner;->onAnimationStart([Landroid/view/RemoteAnimationTarget;Landroid/view/IRemoteAnimationFinishedCallback;)V Landroid/view/IRotationWatcher$Stub;->()V Landroid/view/IWindow$Stub;->()V Landroid/view/IWindow$Stub;->asInterface(Landroid/os/IBinder;)Landroid/view/IWindow; @@ -1492,44 +1478,7 @@ Landroid/view/IWindowManager$Stub$Proxy;->hasNavigationBar(I)Z Landroid/view/IWindowManager$Stub$Proxy;->watchRotation(Landroid/view/IRotationWatcher;I)I Landroid/view/IWindowManager$Stub;->()V Landroid/view/IWindowManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/view/IWindowManager; -Landroid/view/IWindowManager;->createInputConsumer(Landroid/os/IBinder;Ljava/lang/String;ILandroid/view/InputChannel;)V -Landroid/view/IWindowManager;->destroyInputConsumer(Ljava/lang/String;I)Z -Landroid/view/IWindowManager;->endProlongedAnimations()V -Landroid/view/IWindowManager;->executeAppTransition()V -Landroid/view/IWindowManager;->freezeRotation(I)V -Landroid/view/IWindowManager;->getAnimationScale(I)F -Landroid/view/IWindowManager;->getAnimationScales()[F -Landroid/view/IWindowManager;->getBaseDisplaySize(ILandroid/graphics/Point;)V -Landroid/view/IWindowManager;->getDockedStackSide()I -Landroid/view/IWindowManager;->getInitialDisplayDensity(I)I -Landroid/view/IWindowManager;->getInitialDisplaySize(ILandroid/graphics/Point;)V -Landroid/view/IWindowManager;->getStableInsets(ILandroid/graphics/Rect;)V -Landroid/view/IWindowManager;->hasNavigationBar(I)Z -Landroid/view/IWindowManager;->isKeyguardLocked()Z -Landroid/view/IWindowManager;->isKeyguardSecure()Z -Landroid/view/IWindowManager;->isSafeModeEnabled()Z -Landroid/view/IWindowManager;->lockNow(Landroid/os/Bundle;)V -Landroid/view/IWindowManager;->overridePendingAppTransitionMultiThumbFuture(Landroid/view/IAppTransitionAnimationSpecsFuture;Landroid/os/IRemoteCallback;ZI)V -Landroid/view/IWindowManager;->overridePendingAppTransitionRemote(Landroid/view/RemoteAnimationAdapter;I)V -Landroid/view/IWindowManager;->registerDockedStackListener(Landroid/view/IDockedStackListener;)V -Landroid/view/IWindowManager;->removeRotationWatcher(Landroid/view/IRotationWatcher;)V -Landroid/view/IWindowManager;->setAnimationScale(IF)V -Landroid/view/IWindowManager;->setAnimationScales([F)V -Landroid/view/IWindowManager;->setNavBarVirtualKeyHapticFeedbackEnabled(Z)V -Landroid/view/IWindowManager;->setShelfHeight(ZI)V -Landroid/view/IWindowManager;->setStrictModeVisualIndicatorPreference(Ljava/lang/String;)V -Landroid/view/IWindowManager;->thawRotation()V Landroid/view/IWindowSession$Stub;->asInterface(Landroid/os/IBinder;)Landroid/view/IWindowSession; -Landroid/view/IWindowSession;->finishDrawing(Landroid/view/IWindow;)V -Landroid/view/IWindowSession;->getInTouchMode()Z -Landroid/view/IWindowSession;->performDrag(Landroid/view/IWindow;ILandroid/view/SurfaceControl;IFFFFLandroid/content/ClipData;)Landroid/os/IBinder; -Landroid/view/IWindowSession;->performHapticFeedback(IZ)Z -Landroid/view/IWindowSession;->remove(Landroid/view/IWindow;)V -Landroid/view/IWindowSession;->setInTouchMode(Z)V -Landroid/view/IWindowSession;->setTransparentRegion(Landroid/view/IWindow;Landroid/graphics/Region;)V -Landroid/view/IWindowSession;->wallpaperCommandComplete(Landroid/os/IBinder;Landroid/os/Bundle;)V -Landroid/view/IWindowSession;->wallpaperOffsetsComplete(Landroid/os/IBinder;)V -Landroid/view/RenderNodeAnimator;->setDuration(J)Landroid/view/RenderNodeAnimator; Landroid/view/View$AttachInfo$InvalidateInfo;->()V Landroid/view/View$CheckForLongPress;->(Landroid/view/View;)V Landroid/view/View$ListenerInfo;->()V @@ -1538,9 +1487,6 @@ Landroid/webkit/CacheManager$CacheResult;->()V Landroid/webkit/IWebViewUpdateService$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/webkit/IWebViewUpdateService$Stub$Proxy;->waitForAndGetProvider()Landroid/webkit/WebViewProviderResponse; Landroid/webkit/IWebViewUpdateService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/webkit/IWebViewUpdateService; -Landroid/webkit/IWebViewUpdateService;->getCurrentWebViewPackageName()Ljava/lang/String; -Landroid/webkit/IWebViewUpdateService;->getValidWebViewPackages()[Landroid/webkit/WebViewProviderInfo; -Landroid/webkit/IWebViewUpdateService;->isFallbackPackage(Ljava/lang/String;)Z Landroid/widget/DigitalClock$FormatChangeObserver;->(Landroid/widget/DigitalClock;)V Landroid/widget/QuickContactBadge$QueryHandler;->(Landroid/widget/QuickContactBadge;Landroid/content/ContentResolver;)V Landroid/widget/RelativeLayout$DependencyGraph$Node;->()V diff --git a/core/java/android/speech/IRecognitionListener.aidl b/core/java/android/speech/IRecognitionListener.aidl index 3d3c44bf1ef..e77851b0e40 100644 --- a/core/java/android/speech/IRecognitionListener.aidl +++ b/core/java/android/speech/IRecognitionListener.aidl @@ -83,5 +83,6 @@ oneway interface IRecognitionListener { * @param eventType the type of the occurred event * @param params a Bundle containing the passed parameters */ + @UnsupportedAppUsage void onEvent(in int eventType, in Bundle params); } diff --git a/core/java/android/view/IRecentsAnimationController.aidl b/core/java/android/view/IRecentsAnimationController.aidl index 94b9bc099d5..b1f934a44cd 100644 --- a/core/java/android/view/IRecentsAnimationController.aidl +++ b/core/java/android/view/IRecentsAnimationController.aidl @@ -33,6 +33,7 @@ interface IRecentsAnimationController { * Takes a screenshot of the task associated with the given {@param taskId}. Only valid for the * current set of task ids provided to the handler. */ + @UnsupportedAppUsage ActivityManager.TaskSnapshot screenshotTask(int taskId); /** @@ -41,6 +42,7 @@ interface IRecentsAnimationController { * the home activity should be moved to the top. Otherwise, the home activity is hidden and the * user is returned to the app. */ + @UnsupportedAppUsage void finish(boolean moveHomeToTop); /** @@ -50,6 +52,7 @@ interface IRecentsAnimationController { * may register the recents animation input consumer prior to starting the recents animation * and then enable it mid-animation to start receiving touch events. */ + @UnsupportedAppUsage void setInputConsumerEnabled(boolean enabled); /** @@ -58,6 +61,7 @@ interface IRecentsAnimationController { * they can control the SystemUI flags, otherwise the SystemUI flags from home activity will be * taken. */ + @UnsupportedAppUsage void setAnimationTargetsBehindSystemBars(boolean behindSystemBars); /** diff --git a/core/java/android/view/IRecentsAnimationRunner.aidl b/core/java/android/view/IRecentsAnimationRunner.aidl index 4cdf6644151..6e382f416b6 100644 --- a/core/java/android/view/IRecentsAnimationRunner.aidl +++ b/core/java/android/view/IRecentsAnimationRunner.aidl @@ -33,6 +33,7 @@ oneway interface IRecentsAnimationRunner { * wallpaper not drawing in time, or the handler not finishing the animation within a predefined * amount of time. */ + @UnsupportedAppUsage void onAnimationCanceled() = 1; /** @@ -42,6 +43,7 @@ oneway interface IRecentsAnimationRunner { * @param minimizedHomeBounds Specifies the bounds of the minimized home app, will be * {@code null} if the device is not currently in split screen */ + @UnsupportedAppUsage void onAnimationStart(in IRecentsAnimationController controller, in RemoteAnimationTarget[] apps, in Rect homeContentInsets, in Rect minimizedHomeBounds) = 2; diff --git a/core/java/android/view/IRemoteAnimationFinishedCallback.aidl b/core/java/android/view/IRemoteAnimationFinishedCallback.aidl index ae58b226ec0..a99162b6c85 100644 --- a/core/java/android/view/IRemoteAnimationFinishedCallback.aidl +++ b/core/java/android/view/IRemoteAnimationFinishedCallback.aidl @@ -23,5 +23,6 @@ package android.view; * {@hide} */ interface IRemoteAnimationFinishedCallback { + @UnsupportedAppUsage void onAnimationFinished(); } diff --git a/core/java/android/view/IRemoteAnimationRunner.aidl b/core/java/android/view/IRemoteAnimationRunner.aidl index 1350ebf10a4..73b023c9966 100644 --- a/core/java/android/view/IRemoteAnimationRunner.aidl +++ b/core/java/android/view/IRemoteAnimationRunner.aidl @@ -33,6 +33,7 @@ oneway interface IRemoteAnimationRunner { * @param apps The list of apps to animate. * @param finishedCallback The callback to invoke when the animation is finished. */ + @UnsupportedAppUsage void onAnimationStart(in RemoteAnimationTarget[] apps, in IRemoteAnimationFinishedCallback finishedCallback); @@ -40,5 +41,6 @@ oneway interface IRemoteAnimationRunner { * Called when the animation was cancelled. From this point on, any updates onto the leashes * won't have any effect anymore. */ + @UnsupportedAppUsage void onAnimationCancelled(); } diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl index 5dc54a56667..e32c4e136a6 100644 --- a/core/java/android/view/IWindowManager.aidl +++ b/core/java/android/view/IWindowManager.aidl @@ -74,10 +74,13 @@ interface IWindowManager IWindowSession openSession(in IWindowSessionCallback callback); + @UnsupportedAppUsage void getInitialDisplaySize(int displayId, out Point size); + @UnsupportedAppUsage void getBaseDisplaySize(int displayId, out Point size); void setForcedDisplaySize(int displayId, int width, int height); void clearForcedDisplaySize(int displayId); + @UnsupportedAppUsage int getInitialDisplayDensity(int displayId); int getBaseDisplayDensity(int displayId); void setForcedDisplayDensityForUser(int displayId, int density, int userId); @@ -97,17 +100,21 @@ interface IWindowManager * used for recents, where generating the thumbnails of the specs takes a non-trivial amount of * time, so we want to move that off the critical path for starting the new activity. */ + @UnsupportedAppUsage void overridePendingAppTransitionMultiThumbFuture( IAppTransitionAnimationSpecsFuture specsFuture, IRemoteCallback startedCallback, boolean scaleUp, int displayId); + @UnsupportedAppUsage void overridePendingAppTransitionRemote(in RemoteAnimationAdapter remoteAnimationAdapter, int displayId); + @UnsupportedAppUsage void executeAppTransition(); /** * Used by system ui to report that recents has shown itself. * @deprecated to be removed once prebuilts are updated */ + @UnsupportedAppUsage void endProlongedAnimations(); void startFreezingScreen(int exitAnim, int enterAnim); @@ -119,7 +126,9 @@ interface IWindowManager /** @deprecated use Activity.setShowWhenLocked instead. */ void reenableKeyguard(IBinder token, int userId); void exitKeyguardSecurely(IOnKeyguardExitResult callback); + @UnsupportedAppUsage boolean isKeyguardLocked(); + @UnsupportedAppUsage boolean isKeyguardSecure(); void dismissKeyguard(IKeyguardDismissCallback callback, CharSequence message); @@ -129,9 +138,13 @@ interface IWindowManager void closeSystemDialogs(String reason); // These can only be called with the SET_ANIMATON_SCALE permission. + @UnsupportedAppUsage float getAnimationScale(int which); + @UnsupportedAppUsage float[] getAnimationScales(); + @UnsupportedAppUsage void setAnimationScale(int which, float scale); + @UnsupportedAppUsage void setAnimationScales(in float[] scales); float getCurrentAnimatorScale(); @@ -150,6 +163,7 @@ interface IWindowManager // should be enabled. The 'enabled' value is null or blank for // the system default (differs per build variant) or any valid // boolean string as parsed by SystemProperties.getBoolean(). + @UnsupportedAppUsage void setStrictModeVisualIndicatorPreference(String enabled); /** @@ -188,6 +202,7 @@ interface IWindowManager * Remove a rotation watcher set using watchRotation. * @hide */ + @UnsupportedAppUsage void removeRotationWatcher(IRotationWatcher watcher); /** @@ -203,12 +218,14 @@ interface IWindowManager * Equivalent to calling {@link #freezeDisplayRotation(int, int)} with {@link * android.view.Display#DEFAULT_DISPLAY} and given rotation. */ + @UnsupportedAppUsage void freezeRotation(int rotation); /** * Equivalent to calling {@link #thawDisplayRotation(int)} with {@link * android.view.Display#DEFAULT_DISPLAY}. */ + @UnsupportedAppUsage void thawRotation(); /** @@ -286,11 +303,13 @@ interface IWindowManager /** * Called by System UI to notify of changes to the visibility and height of the shelf. */ + @UnsupportedAppUsage void setShelfHeight(boolean visible, int shelfHeight); /** * Called by System UI to enable or disable haptic feedback on the navigation bar buttons. */ + @UnsupportedAppUsage void setNavBarVirtualKeyHapticFeedbackEnabled(boolean enabled); /** @@ -298,6 +317,7 @@ interface IWindowManager * * @param displayId the id of display to check if there is a software navigation bar. */ + @UnsupportedAppUsage boolean hasNavigationBar(int displayId); /** @@ -308,11 +328,13 @@ interface IWindowManager /** * Lock the device immediately with the specified options (can be null). */ + @UnsupportedAppUsage void lockNow(in Bundle options); /** * Device is in safe mode. */ + @UnsupportedAppUsage boolean isSafeModeEnabled(); /** @@ -340,6 +362,7 @@ interface IWindowManager * @return the dock side the current docked stack is at; must be one of the * WindowManagerGlobal.DOCKED_* values */ + @UnsupportedAppUsage int getDockedStackSide(); /** @@ -352,6 +375,7 @@ interface IWindowManager * Registers a listener that will be called when the dock divider changes its visibility or when * the docked stack gets added/removed. */ + @UnsupportedAppUsage void registerDockedStackListener(IDockedStackListener listener); /** @@ -378,6 +402,7 @@ interface IWindowManager /** * Retrieves the current stable insets from the primary display. */ + @UnsupportedAppUsage void getStableInsets(int displayId, out Rect outInsets); /** @@ -400,6 +425,7 @@ interface IWindowManager /** * Create an input consumer by name and display id. */ + @UnsupportedAppUsage void createInputConsumer(IBinder token, String name, int displayId, out InputChannel inputChannel); @@ -407,6 +433,7 @@ interface IWindowManager * Destroy an input consumer by name and display id. * This method will also dispose the input channels associated with that InputConsumer. */ + @UnsupportedAppUsage boolean destroyInputConsumer(String name, int displayId); /** diff --git a/core/java/android/view/IWindowSession.aidl b/core/java/android/view/IWindowSession.aidl index 240aad5a0c5..1fcd4321cdd 100644 --- a/core/java/android/view/IWindowSession.aidl +++ b/core/java/android/view/IWindowSession.aidl @@ -46,6 +46,7 @@ interface IWindowSession { int addToDisplayWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs, in int viewVisibility, in int layerStackId, out Rect outContentInsets, out Rect outStableInsets, out InsetsState insetsState); + @UnsupportedAppUsage void remove(IWindow window); /** @@ -122,6 +123,7 @@ interface IWindowSession { * completely transparent, allowing it to work with the surface flinger * to optimize compositing of this part of the window. */ + @UnsupportedAppUsage void setTransparentRegion(IWindow window, in Region region); /** @@ -143,11 +145,15 @@ interface IWindowSession { */ void getDisplayFrame(IWindow window, out Rect outDisplayFrame); + @UnsupportedAppUsage void finishDrawing(IWindow window); + @UnsupportedAppUsage void setInTouchMode(boolean showFocus); + @UnsupportedAppUsage boolean getInTouchMode(); + @UnsupportedAppUsage boolean performHapticFeedback(int effectId, boolean always); /** @@ -166,6 +172,7 @@ interface IWindowSession { * @param data Data transferred by drag and drop * @return Token of drag operation which will be passed to cancelDragAndDrop. */ + @UnsupportedAppUsage IBinder performDrag(IWindow window, int flags, in SurfaceControl surface, int touchSource, float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data); @@ -199,6 +206,7 @@ interface IWindowSession { */ void setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep); + @UnsupportedAppUsage void wallpaperOffsetsComplete(IBinder window); /** @@ -209,6 +217,7 @@ interface IWindowSession { Bundle sendWallpaperCommand(IBinder window, String action, int x, int y, int z, in Bundle extras, boolean sync); + @UnsupportedAppUsage void wallpaperCommandComplete(IBinder window, in Bundle result); /** diff --git a/core/java/android/view/RenderNodeAnimator.java b/core/java/android/view/RenderNodeAnimator.java index 23f2b8a0a3c..7ab9534941c 100644 --- a/core/java/android/view/RenderNodeAnimator.java +++ b/core/java/android/view/RenderNodeAnimator.java @@ -336,6 +336,7 @@ public class RenderNodeAnimator extends Animator { return mUnscaledStartDelay; } + @UnsupportedAppUsage @Override public RenderNodeAnimator setDuration(long duration) { checkMutable(); diff --git a/core/java/android/webkit/IWebViewUpdateService.aidl b/core/java/android/webkit/IWebViewUpdateService.aidl index dbca7ff72c7..10cfea166ab 100644 --- a/core/java/android/webkit/IWebViewUpdateService.aidl +++ b/core/java/android/webkit/IWebViewUpdateService.aidl @@ -51,6 +51,7 @@ interface IWebViewUpdateService { * DevelopmentSettings uses this to get the current available WebView * providers (to display as choices to the user). */ + @UnsupportedAppUsage WebViewProviderInfo[] getValidWebViewPackages(); /** @@ -61,6 +62,7 @@ interface IWebViewUpdateService { /** * Used by DevelopmentSetting to get the name of the WebView provider currently in use. */ + @UnsupportedAppUsage String getCurrentWebViewPackageName(); /** @@ -72,6 +74,7 @@ interface IWebViewUpdateService { * Used by Settings to determine whether a certain package can be enabled/disabled by the user - * the package should not be modifiable in this way if it is a fallback package. */ + @UnsupportedAppUsage boolean isFallbackPackage(String packageName); /** diff --git a/telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl b/telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl index c90ffc7726e..c140127237d 100755 --- a/telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl +++ b/telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl @@ -26,13 +26,17 @@ import android.telephony.mbms.StreamingServiceInfo; */ interface IMbmsStreamingService { + @UnsupportedAppUsage int initialize(IMbmsStreamingSessionCallback callback, int subId); + @UnsupportedAppUsage int requestUpdateStreamingServices(int subId, in List serviceClasses); + @UnsupportedAppUsage int startStreaming(int subId, String serviceId, IStreamingServiceCallback callback); + @UnsupportedAppUsage Uri getPlaybackUri(int subId, String serviceId); void stopStreaming(int subId, String serviceId); -- GitLab From 903da3725f33d32e63daa8ec74ec0aca26b948e9 Mon Sep 17 00:00:00 2001 From: Andrei Onea Date: Wed, 27 Feb 2019 15:45:08 +0000 Subject: [PATCH 043/398] Add @UnsupportedAppUsage annotations For packages: com.android.ims com.android.ims.internal com.android.ims.internal.uce.options com.android.ims.internal.uce.presence com.android.ims.internal.uce.uceservice This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: I13583455e85c78cfca5f4d67e4b982b58178104e --- config/hiddenapi-greylist.txt | 88 ------------------- .../com/android/ims/ImsConfigListener.aidl | 1 + .../ims/internal/IImsCallSessionListener.aidl | 22 +++++ .../internal/IImsRegistrationListener.aidl | 8 ++ .../android/ims/internal/IImsUtListener.aidl | 7 ++ .../ims/internal/IImsVideoCallCallback.aidl | 7 ++ .../ims/internal/IImsVideoCallProvider.aidl | 1 + .../uce/options/IOptionsListener.aidl | 6 ++ .../internal/uce/options/IOptionsService.aidl | 8 ++ .../uce/presence/IPresenceListener.aidl | 9 ++ .../uce/presence/IPresenceService.aidl | 8 ++ .../internal/uce/uceservice/IUceListener.aidl | 1 + .../internal/uce/uceservice/IUceService.aidl | 10 +++ 13 files changed, 88 insertions(+), 88 deletions(-) diff --git a/config/hiddenapi-greylist.txt b/config/hiddenapi-greylist.txt index e25f463a944..e2da8ec079b 100644 --- a/config/hiddenapi-greylist.txt +++ b/config/hiddenapi-greylist.txt @@ -1550,7 +1550,6 @@ Lcom/android/ims/ImsCall;->isMultiparty()Z Lcom/android/ims/ImsCall;->reject(I)V Lcom/android/ims/ImsCall;->terminate(I)V Lcom/android/ims/ImsConfigListener$Stub;->()V -Lcom/android/ims/ImsConfigListener;->onSetFeatureResponse(IIII)V Lcom/android/ims/ImsEcbm;->exitEmergencyCallbackMode()V Lcom/android/ims/ImsManager;->getConfigInterface()Lcom/android/ims/ImsConfig; Lcom/android/ims/ImsManager;->getInstance(Landroid/content/Context;I)Lcom/android/ims/ImsManager; @@ -1560,104 +1559,17 @@ Lcom/android/ims/ImsManager;->isVolteEnabledByPlatform(Landroid/content/Context; Lcom/android/ims/ImsUtInterface;->queryCallForward(ILjava/lang/String;Landroid/os/Message;)V Lcom/android/ims/internal/IImsCallSession$Stub;->()V Lcom/android/ims/internal/IImsCallSession$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/ims/internal/IImsCallSession; -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionConferenceStateUpdated(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsConferenceState;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionHandover(Lcom/android/ims/internal/IImsCallSession;IILandroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionHandoverFailed(Lcom/android/ims/internal/IImsCallSession;IILandroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionHeld(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionHoldFailed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionHoldReceived(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionInviteParticipantsRequestDelivered(Lcom/android/ims/internal/IImsCallSession;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionInviteParticipantsRequestFailed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionMergeComplete(Lcom/android/ims/internal/IImsCallSession;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionMergeFailed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionMergeStarted(Lcom/android/ims/internal/IImsCallSession;Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionMultipartyStateChanged(Lcom/android/ims/internal/IImsCallSession;Z)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionProgressing(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsStreamMediaProfile;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionResumed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionResumeFailed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionResumeReceived(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionStarted(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionStartFailed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionSuppServiceReceived(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsSuppServiceNotification;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionTerminated(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionTtyModeReceived(Lcom/android/ims/internal/IImsCallSession;I)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionUpdated(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V Lcom/android/ims/internal/IImsConfig$Stub;->()V Lcom/android/ims/internal/IImsEcbm$Stub;->()V -Lcom/android/ims/internal/IImsRegistrationListener;->registrationAssociatedUriChanged([Landroid/net/Uri;)V -Lcom/android/ims/internal/IImsRegistrationListener;->registrationChangeFailed(ILandroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsRegistrationListener;->registrationConnected()V -Lcom/android/ims/internal/IImsRegistrationListener;->registrationConnectedWithRadioTech(I)V -Lcom/android/ims/internal/IImsRegistrationListener;->registrationDisconnected(Landroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsRegistrationListener;->registrationFeatureCapabilityChanged(I[I[I)V -Lcom/android/ims/internal/IImsRegistrationListener;->registrationProgressingWithRadioTech(I)V -Lcom/android/ims/internal/IImsRegistrationListener;->voiceMessageCountUpdate(I)V Lcom/android/ims/internal/IImsService$Stub;->()V Lcom/android/ims/internal/IImsService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/ims/internal/IImsService; Lcom/android/ims/internal/IImsUt$Stub;->()V -Lcom/android/ims/internal/IImsUtListener;->utConfigurationCallBarringQueried(Lcom/android/ims/internal/IImsUt;I[Landroid/telephony/ims/ImsSsInfo;)V -Lcom/android/ims/internal/IImsUtListener;->utConfigurationCallForwardQueried(Lcom/android/ims/internal/IImsUt;I[Landroid/telephony/ims/ImsCallForwardInfo;)V -Lcom/android/ims/internal/IImsUtListener;->utConfigurationCallWaitingQueried(Lcom/android/ims/internal/IImsUt;I[Landroid/telephony/ims/ImsSsInfo;)V -Lcom/android/ims/internal/IImsUtListener;->utConfigurationQueried(Lcom/android/ims/internal/IImsUt;ILandroid/os/Bundle;)V -Lcom/android/ims/internal/IImsUtListener;->utConfigurationQueryFailed(Lcom/android/ims/internal/IImsUt;ILandroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsUtListener;->utConfigurationUpdated(Lcom/android/ims/internal/IImsUt;I)V -Lcom/android/ims/internal/IImsUtListener;->utConfigurationUpdateFailed(Lcom/android/ims/internal/IImsUt;ILandroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsVideoCallCallback;->changeCallDataUsage(J)V -Lcom/android/ims/internal/IImsVideoCallCallback;->changeCameraCapabilities(Landroid/telecom/VideoProfile$CameraCapabilities;)V -Lcom/android/ims/internal/IImsVideoCallCallback;->changePeerDimensions(II)V -Lcom/android/ims/internal/IImsVideoCallCallback;->changeVideoQuality(I)V -Lcom/android/ims/internal/IImsVideoCallCallback;->handleCallSessionEvent(I)V -Lcom/android/ims/internal/IImsVideoCallCallback;->receiveSessionModifyRequest(Landroid/telecom/VideoProfile;)V -Lcom/android/ims/internal/IImsVideoCallCallback;->receiveSessionModifyResponse(ILandroid/telecom/VideoProfile;Landroid/telecom/VideoProfile;)V Lcom/android/ims/internal/IImsVideoCallProvider$Stub;->()V -Lcom/android/ims/internal/IImsVideoCallProvider;->setCallback(Lcom/android/ims/internal/IImsVideoCallCallback;)V Lcom/android/ims/internal/ImsVideoCallProviderWrapper;->(Lcom/android/ims/internal/IImsVideoCallProvider;)V -Lcom/android/ims/internal/uce/options/IOptionsListener;->cmdStatus(Lcom/android/ims/internal/uce/options/OptionsCmdStatus;)V -Lcom/android/ims/internal/uce/options/IOptionsListener;->getVersionCb(Ljava/lang/String;)V -Lcom/android/ims/internal/uce/options/IOptionsListener;->incomingOptions(Ljava/lang/String;Lcom/android/ims/internal/uce/options/OptionsCapInfo;I)V -Lcom/android/ims/internal/uce/options/IOptionsListener;->serviceAvailable(Lcom/android/ims/internal/uce/common/StatusCode;)V -Lcom/android/ims/internal/uce/options/IOptionsListener;->serviceUnavailable(Lcom/android/ims/internal/uce/common/StatusCode;)V -Lcom/android/ims/internal/uce/options/IOptionsListener;->sipResponseReceived(Ljava/lang/String;Lcom/android/ims/internal/uce/options/OptionsSipResponse;Lcom/android/ims/internal/uce/options/OptionsCapInfo;)V Lcom/android/ims/internal/uce/options/IOptionsService$Stub;->()V -Lcom/android/ims/internal/uce/options/IOptionsService;->addListener(ILcom/android/ims/internal/uce/options/IOptionsListener;Lcom/android/ims/internal/uce/common/UceLong;)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/options/IOptionsService;->getContactCap(ILjava/lang/String;I)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/options/IOptionsService;->getContactListCap(I[Ljava/lang/String;I)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/options/IOptionsService;->getMyInfo(II)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/options/IOptionsService;->getVersion(I)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/options/IOptionsService;->removeListener(ILcom/android/ims/internal/uce/common/UceLong;)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/options/IOptionsService;->responseIncomingOptions(IIILjava/lang/String;Lcom/android/ims/internal/uce/options/OptionsCapInfo;Z)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/options/IOptionsService;->setMyInfo(ILcom/android/ims/internal/uce/common/CapInfo;I)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/presence/IPresenceListener;->capInfoReceived(Ljava/lang/String;[Lcom/android/ims/internal/uce/presence/PresTupleInfo;)V -Lcom/android/ims/internal/uce/presence/IPresenceListener;->cmdStatus(Lcom/android/ims/internal/uce/presence/PresCmdStatus;)V -Lcom/android/ims/internal/uce/presence/IPresenceListener;->getVersionCb(Ljava/lang/String;)V -Lcom/android/ims/internal/uce/presence/IPresenceListener;->listCapInfoReceived(Lcom/android/ims/internal/uce/presence/PresRlmiInfo;[Lcom/android/ims/internal/uce/presence/PresResInfo;)V -Lcom/android/ims/internal/uce/presence/IPresenceListener;->publishTriggering(Lcom/android/ims/internal/uce/presence/PresPublishTriggerType;)V -Lcom/android/ims/internal/uce/presence/IPresenceListener;->serviceAvailable(Lcom/android/ims/internal/uce/common/StatusCode;)V -Lcom/android/ims/internal/uce/presence/IPresenceListener;->serviceUnAvailable(Lcom/android/ims/internal/uce/common/StatusCode;)V -Lcom/android/ims/internal/uce/presence/IPresenceListener;->sipResponseReceived(Lcom/android/ims/internal/uce/presence/PresSipResponse;)V -Lcom/android/ims/internal/uce/presence/IPresenceListener;->unpublishMessageSent()V Lcom/android/ims/internal/uce/presence/IPresenceService$Stub;->()V -Lcom/android/ims/internal/uce/presence/IPresenceService;->addListener(ILcom/android/ims/internal/uce/presence/IPresenceListener;Lcom/android/ims/internal/uce/common/UceLong;)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/presence/IPresenceService;->getContactCap(ILjava/lang/String;I)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/presence/IPresenceService;->getContactListCap(I[Ljava/lang/String;I)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/presence/IPresenceService;->getVersion(I)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/presence/IPresenceService;->publishMyCap(ILcom/android/ims/internal/uce/presence/PresCapInfo;I)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/presence/IPresenceService;->reenableService(II)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/presence/IPresenceService;->removeListener(ILcom/android/ims/internal/uce/common/UceLong;)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/presence/IPresenceService;->setNewFeatureTag(ILjava/lang/String;Lcom/android/ims/internal/uce/presence/PresServiceInfo;I)Lcom/android/ims/internal/uce/common/StatusCode; Lcom/android/ims/internal/uce/uceservice/IUceListener$Stub;->()V -Lcom/android/ims/internal/uce/uceservice/IUceListener;->setStatus(I)V Lcom/android/ims/internal/uce/uceservice/IUceService$Stub;->()V -Lcom/android/ims/internal/uce/uceservice/IUceService;->createOptionsService(Lcom/android/ims/internal/uce/options/IOptionsListener;Lcom/android/ims/internal/uce/common/UceLong;)I -Lcom/android/ims/internal/uce/uceservice/IUceService;->createPresenceService(Lcom/android/ims/internal/uce/presence/IPresenceListener;Lcom/android/ims/internal/uce/common/UceLong;)I -Lcom/android/ims/internal/uce/uceservice/IUceService;->destroyOptionsService(I)V -Lcom/android/ims/internal/uce/uceservice/IUceService;->destroyPresenceService(I)V -Lcom/android/ims/internal/uce/uceservice/IUceService;->getOptionsService()Lcom/android/ims/internal/uce/options/IOptionsService; -Lcom/android/ims/internal/uce/uceservice/IUceService;->getPresenceService()Lcom/android/ims/internal/uce/presence/IPresenceService; -Lcom/android/ims/internal/uce/uceservice/IUceService;->getServiceStatus()Z -Lcom/android/ims/internal/uce/uceservice/IUceService;->isServiceStarted()Z -Lcom/android/ims/internal/uce/uceservice/IUceService;->startService(Lcom/android/ims/internal/uce/uceservice/IUceListener;)Z -Lcom/android/ims/internal/uce/uceservice/IUceService;->stopService()Z Lcom/android/internal/app/AlertActivity;->()V Lcom/android/internal/app/AlertActivity;->mAlert:Lcom/android/internal/app/AlertController; Lcom/android/internal/app/AlertActivity;->mAlertParams:Lcom/android/internal/app/AlertController$AlertParams; diff --git a/telephony/java/com/android/ims/ImsConfigListener.aidl b/telephony/java/com/android/ims/ImsConfigListener.aidl index 64a50155255..4f229df252a 100644 --- a/telephony/java/com/android/ims/ImsConfigListener.aidl +++ b/telephony/java/com/android/ims/ImsConfigListener.aidl @@ -47,6 +47,7 @@ oneway interface ImsConfigListener { * * @return void. */ + @UnsupportedAppUsage void onSetFeatureResponse(int feature, int network, int value, int status); /** diff --git a/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl b/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl index 579369f4b54..b33a9f1ad23 100644 --- a/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl +++ b/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl @@ -34,33 +34,47 @@ oneway interface IImsCallSessionListener { /** * Notifies the result of the basic session operation (setup / terminate). */ + @UnsupportedAppUsage void callSessionProgressing(in IImsCallSession session, in ImsStreamMediaProfile profile); + @UnsupportedAppUsage void callSessionStarted(in IImsCallSession session, in ImsCallProfile profile); + @UnsupportedAppUsage void callSessionStartFailed(in IImsCallSession session, in ImsReasonInfo reasonInfo); + @UnsupportedAppUsage void callSessionTerminated(in IImsCallSession session, in ImsReasonInfo reasonInfo); /** * Notifies the result of the call hold/resume operation. */ + @UnsupportedAppUsage void callSessionHeld(in IImsCallSession session, in ImsCallProfile profile); + @UnsupportedAppUsage void callSessionHoldFailed(in IImsCallSession session, in ImsReasonInfo reasonInfo); + @UnsupportedAppUsage void callSessionHoldReceived(in IImsCallSession session, in ImsCallProfile profile); + @UnsupportedAppUsage void callSessionResumed(in IImsCallSession session, in ImsCallProfile profile); + @UnsupportedAppUsage void callSessionResumeFailed(in IImsCallSession session, in ImsReasonInfo reasonInfo); + @UnsupportedAppUsage void callSessionResumeReceived(in IImsCallSession session, in ImsCallProfile profile); /** * Notifies the result of call merge operation. */ + @UnsupportedAppUsage void callSessionMergeStarted(in IImsCallSession session, in IImsCallSession newSession, in ImsCallProfile profile); + @UnsupportedAppUsage void callSessionMergeComplete(in IImsCallSession session); + @UnsupportedAppUsage void callSessionMergeFailed(in IImsCallSession session, in ImsReasonInfo reasonInfo); /** * Notifies the result of call upgrade / downgrade or any other call updates. */ + @UnsupportedAppUsage void callSessionUpdated(in IImsCallSession session, in ImsCallProfile profile); void callSessionUpdateFailed(in IImsCallSession session, @@ -81,7 +95,9 @@ oneway interface IImsCallSessionListener { /** * Notifies the result of the participant invitation / removal to/from the conference session. */ + @UnsupportedAppUsage void callSessionInviteParticipantsRequestDelivered(in IImsCallSession session); + @UnsupportedAppUsage void callSessionInviteParticipantsRequestFailed(in IImsCallSession session, in ImsReasonInfo reasonInfo); void callSessionRemoveParticipantsRequestDelivered(in IImsCallSession session); @@ -91,6 +107,7 @@ oneway interface IImsCallSessionListener { /** * Notifies the changes of the conference info. in the conference session. */ + @UnsupportedAppUsage void callSessionConferenceStateUpdated(in IImsCallSession session, in ImsConferenceState state); @@ -103,8 +120,10 @@ oneway interface IImsCallSessionListener { /** * Notifies of handover information for this call */ + @UnsupportedAppUsage void callSessionHandover(in IImsCallSession session, in int srcAccessTech, in int targetAccessTech, in ImsReasonInfo reasonInfo); + @UnsupportedAppUsage void callSessionHandoverFailed(in IImsCallSession session, in int srcAccessTech, in int targetAccessTech, in ImsReasonInfo reasonInfo); void callSessionMayHandover(in IImsCallSession session, @@ -118,6 +137,7 @@ oneway interface IImsCallSessionListener { * - {@link com.android.internal.telephony.Phone#TTY_MODE_HCO} * - {@link com.android.internal.telephony.Phone#TTY_MODE_VCO} */ + @UnsupportedAppUsage void callSessionTtyModeReceived(in IImsCallSession session, in int mode); /** @@ -126,11 +146,13 @@ oneway interface IImsCallSessionListener { * @param session The call session. * @param isMultiParty {@code true} if the session became multiparty, {@code false} otherwise. */ + @UnsupportedAppUsage void callSessionMultipartyStateChanged(in IImsCallSession session, in boolean isMultiParty); /** * Notifies the supplementary service information for the current session. */ + @UnsupportedAppUsage void callSessionSuppServiceReceived(in IImsCallSession session, in ImsSuppServiceNotification suppSrvNotification); diff --git a/telephony/java/com/android/ims/internal/IImsRegistrationListener.aidl b/telephony/java/com/android/ims/internal/IImsRegistrationListener.aidl index 2212109c8a6..a7a62a62547 100644 --- a/telephony/java/com/android/ims/internal/IImsRegistrationListener.aidl +++ b/telephony/java/com/android/ims/internal/IImsRegistrationListener.aidl @@ -32,6 +32,7 @@ oneway interface IImsRegistrationListener { * * @deprecated see {@link registrationConnectedWithRadioTech} */ + @UnsupportedAppUsage void registrationConnected(); /** @@ -47,6 +48,7 @@ oneway interface IImsRegistrationListener { * @param imsRadioTech the radio access technology. Valid values are {@code * RIL_RADIO_TECHNOLOGY_*} defined in {@link ServiceState}. */ + @UnsupportedAppUsage void registrationConnectedWithRadioTech(int imsRadioTech); /** @@ -55,12 +57,14 @@ oneway interface IImsRegistrationListener { * @param imsRadioTech the radio access technology. Valid values are {@code * RIL_RADIO_TECHNOLOGY_*} defined in {@link ServiceState}. */ + @UnsupportedAppUsage void registrationProgressingWithRadioTech(int imsRadioTech); /** * Notifies the application when the device is disconnected from the IMS network. */ + @UnsupportedAppUsage void registrationDisconnected(in ImsReasonInfo imsReasonInfo); /** @@ -94,6 +98,7 @@ oneway interface IImsRegistrationListener { * @param enabledFeatures features enabled as defined in com.android.ims.ImsConfig#FeatureConstants. * @param disabledFeatures features disabled as defined in com.android.ims.ImsConfig#FeatureConstants. */ + @UnsupportedAppUsage void registrationFeatureCapabilityChanged(int serviceClass, in int[] enabledFeatures, in int[] disabledFeatures); @@ -101,11 +106,13 @@ oneway interface IImsRegistrationListener { * Updates the application with the waiting voice message count. * @param count The number of waiting voice messages. */ + @UnsupportedAppUsage void voiceMessageCountUpdate(int count); /** * Notifies the application when the list of URIs associated with IMS client is updated. */ + @UnsupportedAppUsage void registrationAssociatedUriChanged(in Uri[] uris); /** @@ -116,5 +123,6 @@ oneway interface IImsRegistrationListener { * attempted. * @param imsReasonInfo Reason for the failure. */ + @UnsupportedAppUsage void registrationChangeFailed(in int targetAccessTech, in ImsReasonInfo imsReasonInfo); } diff --git a/telephony/java/com/android/ims/internal/IImsUtListener.aidl b/telephony/java/com/android/ims/internal/IImsUtListener.aidl index a603cd34dfc..fcb9fb1f877 100644 --- a/telephony/java/com/android/ims/internal/IImsUtListener.aidl +++ b/telephony/java/com/android/ims/internal/IImsUtListener.aidl @@ -31,30 +31,37 @@ oneway interface IImsUtListener { /** * Notifies the result of the supplementary service configuration udpate. */ + @UnsupportedAppUsage void utConfigurationUpdated(in IImsUt ut, int id); + @UnsupportedAppUsage void utConfigurationUpdateFailed(in IImsUt ut, int id, in ImsReasonInfo error); /** * Notifies the result of the supplementary service configuration query. */ + @UnsupportedAppUsage void utConfigurationQueried(in IImsUt ut, int id, in Bundle ssInfo); + @UnsupportedAppUsage void utConfigurationQueryFailed(in IImsUt ut, int id, in ImsReasonInfo error); /** * Notifies the status of the call barring supplementary service. */ + @UnsupportedAppUsage void utConfigurationCallBarringQueried(in IImsUt ut, int id, in ImsSsInfo[] cbInfo); /** * Notifies the status of the call forwarding supplementary service. */ + @UnsupportedAppUsage void utConfigurationCallForwardQueried(in IImsUt ut, int id, in ImsCallForwardInfo[] cfInfo); /** * Notifies the status of the call waiting supplementary service. */ + @UnsupportedAppUsage void utConfigurationCallWaitingQueried(in IImsUt ut, int id, in ImsSsInfo[] cwInfo); diff --git a/telephony/java/com/android/ims/internal/IImsVideoCallCallback.aidl b/telephony/java/com/android/ims/internal/IImsVideoCallCallback.aidl index 9499c9f5dde..cf8d6379454 100644 --- a/telephony/java/com/android/ims/internal/IImsVideoCallCallback.aidl +++ b/telephony/java/com/android/ims/internal/IImsVideoCallCallback.aidl @@ -31,18 +31,25 @@ import android.telecom.VideoProfile; * {@hide} */ oneway interface IImsVideoCallCallback { + @UnsupportedAppUsage void receiveSessionModifyRequest(in VideoProfile videoProfile); + @UnsupportedAppUsage void receiveSessionModifyResponse(int status, in VideoProfile requestedProfile, in VideoProfile responseProfile); + @UnsupportedAppUsage void handleCallSessionEvent(int event); + @UnsupportedAppUsage void changePeerDimensions(int width, int height); + @UnsupportedAppUsage void changeCallDataUsage(long dataUsage); + @UnsupportedAppUsage void changeCameraCapabilities(in VideoProfile.CameraCapabilities cameraCapabilities); + @UnsupportedAppUsage void changeVideoQuality(int videoQuality); } diff --git a/telephony/java/com/android/ims/internal/IImsVideoCallProvider.aidl b/telephony/java/com/android/ims/internal/IImsVideoCallProvider.aidl index 0da27e163df..4d20bd67562 100644 --- a/telephony/java/com/android/ims/internal/IImsVideoCallProvider.aidl +++ b/telephony/java/com/android/ims/internal/IImsVideoCallProvider.aidl @@ -41,6 +41,7 @@ import com.android.ims.internal.IImsVideoCallCallback; * @hide */ oneway interface IImsVideoCallProvider { + @UnsupportedAppUsage void setCallback(IImsVideoCallCallback callback); void setCamera(String cameraId, int uid); diff --git a/telephony/java/com/android/ims/internal/uce/options/IOptionsListener.aidl b/telephony/java/com/android/ims/internal/uce/options/IOptionsListener.aidl index 8cb1153c48b..c69d5a94f76 100644 --- a/telephony/java/com/android/ims/internal/uce/options/IOptionsListener.aidl +++ b/telephony/java/com/android/ims/internal/uce/options/IOptionsListener.aidl @@ -29,6 +29,7 @@ interface IOptionsListener * @param version, version information of the service. * @hide */ + @UnsupportedAppUsage void getVersionCb(in String version ); /** @@ -37,6 +38,7 @@ interface IOptionsListener * @param statusCode, UCE_SUCCESS as service availability. * @hide */ + @UnsupportedAppUsage void serviceAvailable(in StatusCode statusCode); /** @@ -45,6 +47,7 @@ interface IOptionsListener * @param statusCode, UCE_SUCCESS as service unavailability. * @hide */ + @UnsupportedAppUsage void serviceUnavailable(in StatusCode statusCode); /** @@ -55,6 +58,7 @@ interface IOptionsListener * @param capInfo, capabilities of the remote entity received. * @hide */ + @UnsupportedAppUsage void sipResponseReceived( String uri, in OptionsSipResponse sipResponse, in OptionsCapInfo capInfo); @@ -63,6 +67,7 @@ interface IOptionsListener * @param cmdStatus, command status of the request placed. * @hide */ + @UnsupportedAppUsage void cmdStatus(in OptionsCmdStatus cmdStatus); /** @@ -73,6 +78,7 @@ interface IOptionsListener * @param tID, transation of the request received from network. * @hide */ + @UnsupportedAppUsage void incomingOptions( String uri, in OptionsCapInfo capInfo, in int tID); } diff --git a/telephony/java/com/android/ims/internal/uce/options/IOptionsService.aidl b/telephony/java/com/android/ims/internal/uce/options/IOptionsService.aidl index 839bb5574d3..2e49082988c 100644 --- a/telephony/java/com/android/ims/internal/uce/options/IOptionsService.aidl +++ b/telephony/java/com/android/ims/internal/uce/options/IOptionsService.aidl @@ -33,6 +33,7 @@ interface IOptionsService * @return StatusCode, status of the request placed. * @hide */ + @UnsupportedAppUsage StatusCode getVersion(int optionsServiceHandle); /** @@ -44,6 +45,7 @@ interface IOptionsService * The service will fill UceLong.mUceLong with optionsServiceListenerHdl * @return StatusCode, status of the request placed. */ + @UnsupportedAppUsage StatusCode addListener(int optionsServiceHandle, IOptionsListener optionsListener, inout UceLong optionsServiceListenerHdl); @@ -54,6 +56,7 @@ interface IOptionsService * @param optionsServiceListenerHdl provided in createOptionsService() or Addlistener(). * @return StatusCode, status of the request placed. */ + @UnsupportedAppUsage StatusCode removeListener(int optionsServiceHandle, in UceLong optionsServiceListenerHdl); /** @@ -66,6 +69,7 @@ interface IOptionsService * with original request. * @return StatusCode, status of the request placed. */ + @UnsupportedAppUsage StatusCode setMyInfo(int optionsServiceHandle , in CapInfo capInfo, int reqUserData); @@ -78,6 +82,7 @@ interface IOptionsService * with original request. * @return StatusCode, status of the request placed. */ + @UnsupportedAppUsage StatusCode getMyInfo(int optionsServiceHandle , int reqUserdata); /** @@ -90,6 +95,7 @@ interface IOptionsService * with original request. * @return StatusCode, status of the request placed. */ + @UnsupportedAppUsage StatusCode getContactCap(int optionsServiceHandle , String remoteURI, int reqUserData); @@ -103,6 +109,7 @@ interface IOptionsService * with original request. * @return StatusCode, status of the request placed. */ + @UnsupportedAppUsage StatusCode getContactListCap(int optionsServiceHandle, in String[] remoteURIList, int reqUserData); @@ -119,6 +126,7 @@ interface IOptionsService * @param bContactInBL, true if the contact is blacklisted, else false. * @return StatusCode, status of the request placed. */ + @UnsupportedAppUsage StatusCode responseIncomingOptions(int optionsServiceHandle, int tId, int sipResponseCode, String reasonPhrase, in OptionsCapInfo capInfo, in boolean bContactInBL); diff --git a/telephony/java/com/android/ims/internal/uce/presence/IPresenceListener.aidl b/telephony/java/com/android/ims/internal/uce/presence/IPresenceListener.aidl index 2ae424f4af8..65e7fc9756b 100644 --- a/telephony/java/com/android/ims/internal/uce/presence/IPresenceListener.aidl +++ b/telephony/java/com/android/ims/internal/uce/presence/IPresenceListener.aidl @@ -36,6 +36,7 @@ interface IPresenceListener * Gets the version of the presence listener implementation. * @param version, version information. */ + @UnsupportedAppUsage void getVersionCb(in String version ); /** @@ -43,6 +44,7 @@ interface IPresenceListener * availability. * @param statusCode, UCE_SUCCESS as service availability. */ + @UnsupportedAppUsage void serviceAvailable(in StatusCode statusCode); /** @@ -50,6 +52,7 @@ interface IPresenceListener * unavailability. * @param statusCode, UCE_SUCCESS as service unAvailability. */ + @UnsupportedAppUsage void serviceUnAvailable(in StatusCode statusCode); /** @@ -57,12 +60,14 @@ interface IPresenceListener * publish request. * @param publishTrigger, Publish trigger for the network being supported. */ + @UnsupportedAppUsage void publishTriggering(in PresPublishTriggerType publishTrigger); /** * Callback function to be invoked to inform the client of the status of an asynchronous call. * @param cmdStatus, command status of the request placed. */ + @UnsupportedAppUsage void cmdStatus( in PresCmdStatus cmdStatus); /** @@ -70,6 +75,7 @@ interface IPresenceListener * such as PUBLISH or SUBSCRIBE, has been received. * @param sipResponse, network response received for the request placed. */ + @UnsupportedAppUsage void sipResponseReceived(in PresSipResponse sipResponse); /** @@ -78,6 +84,7 @@ interface IPresenceListener * @param presentityURI, URI of the remote entity the request was placed. * @param tupleInfo, array of capability information remote entity supports. */ + @UnsupportedAppUsage void capInfoReceived(in String presentityURI, in PresTupleInfo [] tupleInfo); @@ -87,6 +94,7 @@ interface IPresenceListener * @param rlmiInfo, resource infomation received from network. * @param resInfo, array of capabilities received from network for the list of remore URI. */ + @UnsupportedAppUsage void listCapInfoReceived(in PresRlmiInfo rlmiInfo, in PresResInfo [] resInfo); @@ -94,6 +102,7 @@ interface IPresenceListener * Callback function to be invoked to inform the client when Unpublish message * is sent to network. */ + @UnsupportedAppUsage void unpublishMessageSent(); } \ No newline at end of file diff --git a/telephony/java/com/android/ims/internal/uce/presence/IPresenceService.aidl b/telephony/java/com/android/ims/internal/uce/presence/IPresenceService.aidl index fdea6d35c19..26a3e83efcf 100644 --- a/telephony/java/com/android/ims/internal/uce/presence/IPresenceService.aidl +++ b/telephony/java/com/android/ims/internal/uce/presence/IPresenceService.aidl @@ -33,6 +33,7 @@ interface IPresenceService * @param presenceServiceHdl returned in createPresenceService(). * @return StatusCode, status of the request placed. */ + @UnsupportedAppUsage StatusCode getVersion(int presenceServiceHdl); /** @@ -45,6 +46,7 @@ interface IPresenceService * * @return StatusCode, status of the request placed */ + @UnsupportedAppUsage StatusCode addListener(int presenceServiceHdl, IPresenceListener presenceServiceListener, inout UceLong presenceServiceListenerHdl); @@ -54,6 +56,7 @@ interface IPresenceService * @param presenceServiceListenerHdl provided in createPresenceService() or Addlistener(). * @return StatusCode, status of the request placed. */ + @UnsupportedAppUsage StatusCode removeListener(int presenceServiceHdl, in UceLong presenceServiceListenerHdl); /** @@ -69,6 +72,7 @@ interface IPresenceService * with original request. * @return StatusCode, status of the request placed. */ + @UnsupportedAppUsage StatusCode reenableService(int presenceServiceHdl, int userData); /** @@ -81,6 +85,7 @@ interface IPresenceService * with original request. * @return StatusCode, status of the request placed. */ + @UnsupportedAppUsage StatusCode publishMyCap(int presenceServiceHdl, in PresCapInfo myCapInfo , int userData); /** @@ -94,6 +99,7 @@ interface IPresenceService * with original request. * @return StatusCode, status of the request placed. */ + @UnsupportedAppUsage StatusCode getContactCap(int presenceServiceHdl , String remoteUri, int userData); /** @@ -107,6 +113,7 @@ interface IPresenceService * with original request. * @return StatusCode, status of the request placed. */ + @UnsupportedAppUsage StatusCode getContactListCap(int presenceServiceHdl, in String[] remoteUriList, int userData); /** @@ -122,6 +129,7 @@ interface IPresenceService * with original request. * @return StatusCode, status of the request placed. */ + @UnsupportedAppUsage StatusCode setNewFeatureTag(int presenceServiceHdl, String featureTag, in PresServiceInfo serviceInfo, int userData); diff --git a/telephony/java/com/android/ims/internal/uce/uceservice/IUceListener.aidl b/telephony/java/com/android/ims/internal/uce/uceservice/IUceListener.aidl index 13707a16a0c..41abf7d1a1f 100644 --- a/telephony/java/com/android/ims/internal/uce/uceservice/IUceListener.aidl +++ b/telephony/java/com/android/ims/internal/uce/uceservice/IUceListener.aidl @@ -25,5 +25,6 @@ interface IUceListener * @param serviceStatusValue defined in ImsUceManager * @hide */ + @UnsupportedAppUsage void setStatus(int serviceStatusValue); } diff --git a/telephony/java/com/android/ims/internal/uce/uceservice/IUceService.aidl b/telephony/java/com/android/ims/internal/uce/uceservice/IUceService.aidl index 1fb8513d410..ec45371689c 100644 --- a/telephony/java/com/android/ims/internal/uce/uceservice/IUceService.aidl +++ b/telephony/java/com/android/ims/internal/uce/uceservice/IUceService.aidl @@ -38,6 +38,7 @@ interface IUceService * Service status is returned in setStatus callback in IUceListener. * @hide */ + @UnsupportedAppUsage boolean startService(IUceListener uceListener); /** @@ -45,6 +46,7 @@ interface IUceService * @return boolean true if the service stop request is processed successfully, FALSE otherwise. * @hide */ + @UnsupportedAppUsage boolean stopService(); @@ -54,6 +56,7 @@ interface IUceService * @return boolean true if service started else false. * @hide */ + @UnsupportedAppUsage boolean isServiceStarted(); /** @@ -71,6 +74,7 @@ interface IUceService * * @deprecated This is replaced with new API createOptionsServiceForSubscription() */ + @UnsupportedAppUsage int createOptionsService(IOptionsListener optionsListener, inout UceLong optionsServiceListenerHdl); /** @@ -97,6 +101,7 @@ interface IUceService * in IOptionsListener * @hide */ + @UnsupportedAppUsage void destroyOptionsService(int optionsServiceHandle); /** @@ -114,6 +119,7 @@ interface IUceService * * @deprecated This is replaced with new API createPresenceServiceForSubscription() */ + @UnsupportedAppUsage int createPresenceService(IPresenceListener presenceServiceListener, inout UceLong presenceServiceListenerHdl); /** @@ -141,6 +147,7 @@ interface IUceService * * @hide */ + @UnsupportedAppUsage void destroyPresenceService(int presenceServiceHdl); @@ -152,6 +159,7 @@ interface IUceService * * @hide */ + @UnsupportedAppUsage boolean getServiceStatus(); /** @@ -163,6 +171,7 @@ interface IUceService * * @deprecated use API getPresenceServiceForSubscription() */ + @UnsupportedAppUsage IPresenceService getPresenceService(); /** @@ -185,6 +194,7 @@ interface IUceService * * @hide */ + @UnsupportedAppUsage IOptionsService getOptionsService(); /** -- GitLab From e8e150dbff6daf5257da93a60ec50c87ba55ab18 Mon Sep 17 00:00:00 2001 From: Andrei Onea Date: Mon, 18 Feb 2019 18:27:11 +0000 Subject: [PATCH 044/398] Add statslog logging for hidden api usage Statslog logging is done alongside the old logging, with different sampling rates. Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases -t \ android.cts.statsd.atom.UidAtomTests#testHiddenApiUsed Bug: 119217680 Change-Id: If7c38eaee3a3c08434c2e4f2dac45c659ea9cb12 --- core/java/android/os/ZygoteProcess.java | 45 ++++++++++++++++++ core/java/android/provider/Settings.java | 13 +++++- core/java/com/android/internal/os/Zygote.java | 3 ++ .../android/internal/os/ZygoteArguments.java | 15 ++++++ .../android/internal/os/ZygoteConnection.java | 46 ++++++++++++++++--- .../android/provider/SettingsBackupTest.java | 1 + .../server/am/ActivityManagerService.java | 15 ++++++ 7 files changed, 129 insertions(+), 9 deletions(-) diff --git a/core/java/android/os/ZygoteProcess.java b/core/java/android/os/ZygoteProcess.java index e49b65e63c7..650232f7973 100644 --- a/core/java/android/os/ZygoteProcess.java +++ b/core/java/android/os/ZygoteProcess.java @@ -252,6 +252,11 @@ public class ZygoteProcess { */ private int mHiddenApiAccessLogSampleRate; + /** + * Proportion of hidden API accesses that should be logged to statslog; 0 - 0x10000. + */ + private int mHiddenApiAccessStatslogSampleRate; + /** * The state of the connection to the primary zygote. */ @@ -487,6 +492,7 @@ public class ZygoteProcess { "--start-child-zygote", "--set-api-blacklist-exemptions", "--hidden-api-log-sampling-rate", + "--hidden-api-statslog-sampling-rate", "--invoke-with" }; @@ -776,6 +782,21 @@ public class ZygoteProcess { } } + /** + * Set the precentage of detected hidden API accesses that are logged to the new event log. + * + *

This rate will take affect for all new processes forked from the zygote after this call. + * + * @param rate An integer between 0 and 0x10000 inclusive. 0 means no event logging. + */ + public void setHiddenApiAccessStatslogSampleRate(int rate) { + synchronized (mLock) { + mHiddenApiAccessStatslogSampleRate = rate; + maybeSetHiddenApiAccessStatslogSampleRate(primaryZygoteState); + maybeSetHiddenApiAccessStatslogSampleRate(secondaryZygoteState); + } + } + @GuardedBy("mLock") private boolean maybeSetApiBlacklistExemptions(ZygoteState state, boolean sendIfEmpty) { if (state == null || state.isClosed()) { @@ -830,6 +851,30 @@ public class ZygoteProcess { } } + private void maybeSetHiddenApiAccessStatslogSampleRate(ZygoteState state) { + if (state == null || state.isClosed()) { + return; + } + if (mHiddenApiAccessStatslogSampleRate == -1) { + return; + } + try { + state.mZygoteOutputWriter.write(Integer.toString(1)); + state.mZygoteOutputWriter.newLine(); + state.mZygoteOutputWriter.write("--hidden-api-statslog-sampling-rate=" + + Integer.toString(mHiddenApiAccessStatslogSampleRate)); + state.mZygoteOutputWriter.newLine(); + state.mZygoteOutputWriter.flush(); + int status = state.mZygoteInputStream.readInt(); + if (status != 0) { + Slog.e(LOG_TAG, "Failed to set hidden API statslog sampling rate; status " + + status); + } + } catch (IOException ioe) { + Slog.e(LOG_TAG, "Failed to set hidden API statslog sampling rate", ioe); + } + } + /** * Creates a ZygoteState for the primary zygote if it doesn't exist or has been disconnected. */ diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 8acdc8c1255..04ff650e1af 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -13375,14 +13375,23 @@ public final class Settings { "hidden_api_blacklist_exemptions"; /** - * Sampling rate for hidden API access event logs, as an integer in the range 0 to 0x10000 - * inclusive. + * Sampling rate for hidden API access event logs with libmetricslogger, as an integer in + * the range 0 to 0x10000 inclusive. * * @hide */ public static final String HIDDEN_API_ACCESS_LOG_SAMPLING_RATE = "hidden_api_access_log_sampling_rate"; + /** + * Sampling rate for hidden API access event logging with statslog, as an integer in the + * range 0 to 0x10000 inclusive. + * + * @hide + */ + public static final String HIDDEN_API_ACCESS_STATSLOG_SAMPLING_RATE = + "hidden_api_access_statslog_sampling_rate"; + /** * Hidden API enforcement policy for apps. * diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java index 58b48d88fa3..0ccaec0be20 100644 --- a/core/java/com/android/internal/os/Zygote.java +++ b/core/java/com/android/internal/os/Zygote.java @@ -645,6 +645,9 @@ public final class Zygote { } else if (args.mHiddenApiAccessLogSampleRate != -1) { throw new IllegalArgumentException( BLASTULA_ERROR_PREFIX + "--hidden-api-log-sampling-rate="); + } else if (args.mHiddenApiAccessStatslogSampleRate != -1) { + throw new IllegalArgumentException( + BLASTULA_ERROR_PREFIX + "--hidden-api-statslog-sampling-rate="); } else if (args.mInvokeWith != null) { throw new IllegalArgumentException(BLASTULA_ERROR_PREFIX + "--invoke-with"); } else if (args.mPermittedCapabilities != 0 || args.mEffectiveCapabilities != 0) { diff --git a/core/java/com/android/internal/os/ZygoteArguments.java b/core/java/com/android/internal/os/ZygoteArguments.java index 9cb5820a32c..3beee788a58 100644 --- a/core/java/com/android/internal/os/ZygoteArguments.java +++ b/core/java/com/android/internal/os/ZygoteArguments.java @@ -204,6 +204,12 @@ class ZygoteArguments { */ int mHiddenApiAccessLogSampleRate = -1; + /** + * Sampling rate for logging hidden API accesses to statslog. This is sent to the + * pre-forked zygote at boot time, or when it changes, via --hidden-api-statslog-sampling-rate. + */ + int mHiddenApiAccessStatslogSampleRate = -1; + /** * Constructs instance and parses args * @@ -391,6 +397,15 @@ class ZygoteArguments { "Invalid log sampling rate: " + rateStr, nfe); } expectRuntimeArgs = false; + } else if (arg.startsWith("--hidden-api-statslog-sampling-rate=")) { + String rateStr = arg.substring(arg.indexOf('=') + 1); + try { + mHiddenApiAccessStatslogSampleRate = Integer.parseInt(rateStr); + } catch (NumberFormatException nfe) { + throw new IllegalArgumentException( + "Invalid statslog sampling rate: " + rateStr, nfe); + } + expectRuntimeArgs = false; } else if (arg.startsWith("--package-name=")) { if (mPackageName != null) { throw new IllegalArgumentException("Duplicate arg specified"); diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java index c7ba22df570..bcdce311d94 100644 --- a/core/java/com/android/internal/os/ZygoteConnection.java +++ b/core/java/com/android/internal/os/ZygoteConnection.java @@ -37,6 +37,7 @@ import android.system.ErrnoException; import android.system.Os; import android.system.StructPollfd; import android.util.Log; +import android.util.StatsLog; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; @@ -192,9 +193,11 @@ class ZygoteConnection { return handleApiBlacklistExemptions(zygoteServer, parsedArgs.mApiBlacklistExemptions); } - if (parsedArgs.mHiddenApiAccessLogSampleRate != -1) { + if (parsedArgs.mHiddenApiAccessLogSampleRate != -1 + || parsedArgs.mHiddenApiAccessStatslogSampleRate != -1) { return handleHiddenApiAccessLogSampleRate(zygoteServer, - parsedArgs.mHiddenApiAccessLogSampleRate); + parsedArgs.mHiddenApiAccessLogSampleRate, + parsedArgs.mHiddenApiAccessStatslogSampleRate); } if (parsedArgs.mPermittedCapabilities != 0 || parsedArgs.mEffectiveCapabilities != 0) { @@ -396,9 +399,11 @@ class ZygoteConnection { private final MetricsLogger mMetricsLogger = new MetricsLogger(); private static HiddenApiUsageLogger sInstance = new HiddenApiUsageLogger(); private int mHiddenApiAccessLogSampleRate = 0; + private int mHiddenApiAccessStatslogSampleRate = 0; - public static void setHiddenApiAccessLogSampleRate(int sampleRate) { + public static void setHiddenApiAccessLogSampleRates(int sampleRate, int newSampleRate) { sInstance.mHiddenApiAccessLogSampleRate = sampleRate; + sInstance.mHiddenApiAccessStatslogSampleRate = newSampleRate; } public static HiddenApiUsageLogger getInstance() { @@ -410,6 +415,9 @@ class ZygoteConnection { if (sampledValue < mHiddenApiAccessLogSampleRate) { logUsage(packageName, signature, accessMethod, accessDenied); } + if (sampledValue < mHiddenApiAccessStatslogSampleRate) { + newLogUsage(signature, accessMethod, accessDenied); + } } private void logUsage(String packageName, String signature, int accessMethod, @@ -439,6 +447,27 @@ class ZygoteConnection { } mMetricsLogger.write(logMaker); } + + private void newLogUsage(String signature, int accessMethod, boolean accessDenied) { + int accessMethodProto = StatsLog.HIDDEN_API_USED__ACCESS_METHOD__NONE; + switch(accessMethod) { + case HiddenApiUsageLogger.ACCESS_METHOD_NONE: + accessMethodProto = StatsLog.HIDDEN_API_USED__ACCESS_METHOD__NONE; + break; + case HiddenApiUsageLogger.ACCESS_METHOD_REFLECTION: + accessMethodProto = StatsLog.HIDDEN_API_USED__ACCESS_METHOD__REFLECTION; + break; + case HiddenApiUsageLogger.ACCESS_METHOD_JNI: + accessMethodProto = StatsLog.HIDDEN_API_USED__ACCESS_METHOD__JNI; + break; + case HiddenApiUsageLogger.ACCESS_METHOD_LINKING: + accessMethodProto = StatsLog.HIDDEN_API_USED__ACCESS_METHOD__LINKING; + break; + } + int uid = Process.myUid(); + StatsLog.write(StatsLog.HIDDEN_API_USED, uid, signature, + accessMethodProto, accessDenied); + } } /** @@ -450,15 +479,18 @@ class ZygoteConnection { * a Runnable object that must be returned to ZygoteServer.runSelectLoop to be invoked. * * @param zygoteServer The server object that received the request - * @param samplingRate The new sample rate + * @param samplingRate The new sample rate for regular logging + * @param statsdSamplingRate The new sample rate for statslog logging * @return A Runnable object representing a new app in any blastulas spawned from here; the * zygote process will always receive a null value from this function. */ private Runnable handleHiddenApiAccessLogSampleRate(ZygoteServer zygoteServer, - int samplingRate) { + int samplingRate, int statsdSamplingRate) { return stateChangeWithBlastulaPoolReset(zygoteServer, () -> { - ZygoteInit.setHiddenApiAccessLogSampleRate(samplingRate); - HiddenApiUsageLogger.setHiddenApiAccessLogSampleRate(samplingRate); + int maxSamplingRate = Math.max(samplingRate, statsdSamplingRate); + ZygoteInit.setHiddenApiAccessLogSampleRate(maxSamplingRate); + HiddenApiUsageLogger.setHiddenApiAccessLogSampleRates(samplingRate, + statsdSamplingRate); ZygoteInit.setHiddenApiUsageLogger(HiddenApiUsageLogger.getInstance()); }); } diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java index 23cd96382d1..69632c1d416 100644 --- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java +++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java @@ -287,6 +287,7 @@ public class SettingsBackupTest { Settings.Global.HDMI_SYSTEM_AUDIO_CONTROL_ENABLED, Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED, Settings.Global.HIDDEN_API_ACCESS_LOG_SAMPLING_RATE, + Settings.Global.HIDDEN_API_ACCESS_STATSLOG_SAMPLING_RATE, Settings.Global.HIDDEN_API_POLICY, Settings.Global.HIDE_ERROR_DIALOGS, Settings.Global.HTTP_PROXY, diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index f2902b17250..f27660a65d0 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -2129,6 +2129,7 @@ public class ActivityManagerService extends IActivityManager.Stub private String mExemptionsStr; private List mExemptions = Collections.emptyList(); private int mLogSampleRate = -1; + private int mStatslogSampleRate = -1; @HiddenApiEnforcementPolicy private int mPolicy = HIDDEN_API_ENFORCEMENT_DEFAULT; public HiddenApiSettings(Handler handler, Context context) { @@ -2145,6 +2146,11 @@ public class ActivityManagerService extends IActivityManager.Stub Settings.Global.getUriFor(Settings.Global.HIDDEN_API_ACCESS_LOG_SAMPLING_RATE), false, this); + mContext.getContentResolver().registerContentObserver( + Settings.Global.getUriFor( + Settings.Global.HIDDEN_API_ACCESS_STATSLOG_SAMPLING_RATE), + false, + this); mContext.getContentResolver().registerContentObserver( Settings.Global.getUriFor(Settings.Global.HIDDEN_API_POLICY), false, @@ -2181,6 +2187,15 @@ public class ActivityManagerService extends IActivityManager.Stub mLogSampleRate = logSampleRate; ZYGOTE_PROCESS.setHiddenApiAccessLogSampleRate(mLogSampleRate); } + int statslogSampleRate = Settings.Global.getInt(mContext.getContentResolver(), + Settings.Global.HIDDEN_API_ACCESS_STATSLOG_SAMPLING_RATE, 0); + if (statslogSampleRate < 0 || statslogSampleRate > 0x10000) { + statslogSampleRate = -1; + } + if (statslogSampleRate != -1 && statslogSampleRate != mStatslogSampleRate) { + mStatslogSampleRate = statslogSampleRate; + ZYGOTE_PROCESS.setHiddenApiAccessStatslogSampleRate(mStatslogSampleRate); + } mPolicy = getValidEnforcementPolicy(Settings.Global.HIDDEN_API_POLICY); } -- GitLab From 4aa2a2015b44f006e60edeb2426ee4d7b601e229 Mon Sep 17 00:00:00 2001 From: Andrei Onea Date: Wed, 27 Feb 2019 14:22:05 +0000 Subject: [PATCH 045/398] Add @UnsupportedAppUsage annotations For packages: android.security android-service.dreams android.service.euicc android.service.vr android.service.wallpaper This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: I1c8ae08f8d3b4b2f5bf365468f22155f8def09fe --- config/hiddenapi-greylist.txt | 18 ------------------ .../euicc/IDeleteSubscriptionCallback.aidl | 1 + .../euicc/IEraseSubscriptionsCallback.aidl | 1 + ...ltDownloadableSubscriptionListCallback.aidl | 1 + ...wnloadableSubscriptionMetadataCallback.aidl | 1 + .../android/service/euicc/IGetEidCallback.aidl | 1 + .../service/euicc/IGetEuiccInfoCallback.aidl | 1 + .../IGetEuiccProfileInfoListCallback.aidl | 1 + ...inSubscriptionsForFactoryResetCallback.aidl | 1 + .../euicc/ISwitchToSubscriptionCallback.aidl | 1 + .../IUpdateSubscriptionNicknameCallback.aidl | 1 + core/java/android/service/vr/IVrManager.aidl | 2 ++ .../service/wallpaper/IWallpaperEngine.aidl | 4 ++++ .../java/android/security/Credentials.java | 2 ++ .../android/security/IKeyChainService.aidl | 1 + 15 files changed, 19 insertions(+), 18 deletions(-) diff --git a/config/hiddenapi-greylist.txt b/config/hiddenapi-greylist.txt index e25f463a944..6f5264d5ab0 100644 --- a/config/hiddenapi-greylist.txt +++ b/config/hiddenapi-greylist.txt @@ -1360,9 +1360,7 @@ Landroid/R$styleable;->View_visibility:I Landroid/R$styleable;->Window:[I Landroid/R$styleable;->Window_windowBackground:I Landroid/R$styleable;->Window_windowFrame:I -Landroid/security/Credentials;->convertToPem([Ljava/security/cert/Certificate;)[B Landroid/security/IKeyChainService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/security/IKeyChainService; -Landroid/security/IKeyChainService;->requestPrivateKey(Ljava/lang/String;)Ljava/lang/String; Landroid/security/keymaster/KeymasterBlobArgument;->(ILandroid/os/Parcel;)V Landroid/security/keymaster/KeymasterBlobArgument;->(I[B)V Landroid/security/keymaster/KeymasterBlobArgument;->blob:[B @@ -1391,27 +1389,11 @@ Landroid/service/dreams/IDreamManager;->dream()V Landroid/service/dreams/IDreamManager;->getDreamComponents()[Landroid/content/ComponentName; Landroid/service/dreams/IDreamManager;->isDreaming()Z Landroid/service/dreams/IDreamManager;->setDreamComponents([Landroid/content/ComponentName;)V -Landroid/service/euicc/IDeleteSubscriptionCallback;->onComplete(I)V -Landroid/service/euicc/IEraseSubscriptionsCallback;->onComplete(I)V Landroid/service/euicc/IEuiccService$Stub;->()V -Landroid/service/euicc/IGetDefaultDownloadableSubscriptionListCallback;->onComplete(Landroid/service/euicc/GetDefaultDownloadableSubscriptionListResult;)V -Landroid/service/euicc/IGetDownloadableSubscriptionMetadataCallback;->onComplete(Landroid/service/euicc/GetDownloadableSubscriptionMetadataResult;)V -Landroid/service/euicc/IGetEidCallback;->onSuccess(Ljava/lang/String;)V -Landroid/service/euicc/IGetEuiccInfoCallback;->onSuccess(Landroid/telephony/euicc/EuiccInfo;)V -Landroid/service/euicc/IGetEuiccProfileInfoListCallback;->onComplete(Landroid/service/euicc/GetEuiccProfileInfoListResult;)V -Landroid/service/euicc/IRetainSubscriptionsForFactoryResetCallback;->onComplete(I)V -Landroid/service/euicc/ISwitchToSubscriptionCallback;->onComplete(I)V -Landroid/service/euicc/IUpdateSubscriptionNicknameCallback;->onComplete(I)V Landroid/service/notification/INotificationListener$Stub;->()V Landroid/service/persistentdata/IPersistentDataBlockService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/service/persistentdata/IPersistentDataBlockService; Landroid/service/vr/IVrManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/service/vr/IVrManager; -Landroid/service/vr/IVrManager;->getVr2dDisplayId()I -Landroid/service/vr/IVrManager;->getVrModeState()Z Landroid/service/wallpaper/IWallpaperConnection$Stub;->()V -Landroid/service/wallpaper/IWallpaperEngine;->destroy()V -Landroid/service/wallpaper/IWallpaperEngine;->dispatchPointer(Landroid/view/MotionEvent;)V -Landroid/service/wallpaper/IWallpaperEngine;->dispatchWallpaperCommand(Ljava/lang/String;IIILandroid/os/Bundle;)V -Landroid/service/wallpaper/IWallpaperEngine;->setVisibility(Z)V Landroid/service/wallpaper/IWallpaperService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/service/wallpaper/IWallpaperService; Landroid/speech/IRecognitionListener;->onEvent(ILandroid/os/Bundle;)V Landroid/telecom/Log;->i(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V diff --git a/core/java/android/service/euicc/IDeleteSubscriptionCallback.aidl b/core/java/android/service/euicc/IDeleteSubscriptionCallback.aidl index 4667066df86..aff8f1b7b34 100644 --- a/core/java/android/service/euicc/IDeleteSubscriptionCallback.aidl +++ b/core/java/android/service/euicc/IDeleteSubscriptionCallback.aidl @@ -18,5 +18,6 @@ package android.service.euicc; /** @hide */ oneway interface IDeleteSubscriptionCallback { + @UnsupportedAppUsage void onComplete(int result); } \ No newline at end of file diff --git a/core/java/android/service/euicc/IEraseSubscriptionsCallback.aidl b/core/java/android/service/euicc/IEraseSubscriptionsCallback.aidl index c975f1894aa..34b53cc71df 100644 --- a/core/java/android/service/euicc/IEraseSubscriptionsCallback.aidl +++ b/core/java/android/service/euicc/IEraseSubscriptionsCallback.aidl @@ -18,5 +18,6 @@ package android.service.euicc; /** @hide */ oneway interface IEraseSubscriptionsCallback { + @UnsupportedAppUsage void onComplete(int result); } \ No newline at end of file diff --git a/core/java/android/service/euicc/IGetDefaultDownloadableSubscriptionListCallback.aidl b/core/java/android/service/euicc/IGetDefaultDownloadableSubscriptionListCallback.aidl index 0c5a0c692cb..ad69ef13242 100644 --- a/core/java/android/service/euicc/IGetDefaultDownloadableSubscriptionListCallback.aidl +++ b/core/java/android/service/euicc/IGetDefaultDownloadableSubscriptionListCallback.aidl @@ -20,5 +20,6 @@ import android.service.euicc.GetDefaultDownloadableSubscriptionListResult; /** @hide */ oneway interface IGetDefaultDownloadableSubscriptionListCallback { + @UnsupportedAppUsage void onComplete(in GetDefaultDownloadableSubscriptionListResult result); } \ No newline at end of file diff --git a/core/java/android/service/euicc/IGetDownloadableSubscriptionMetadataCallback.aidl b/core/java/android/service/euicc/IGetDownloadableSubscriptionMetadataCallback.aidl index 3353061ad93..01f187ed11e 100644 --- a/core/java/android/service/euicc/IGetDownloadableSubscriptionMetadataCallback.aidl +++ b/core/java/android/service/euicc/IGetDownloadableSubscriptionMetadataCallback.aidl @@ -20,5 +20,6 @@ import android.service.euicc.GetDownloadableSubscriptionMetadataResult; /** @hide */ oneway interface IGetDownloadableSubscriptionMetadataCallback { + @UnsupportedAppUsage void onComplete(in GetDownloadableSubscriptionMetadataResult result); } \ No newline at end of file diff --git a/core/java/android/service/euicc/IGetEidCallback.aidl b/core/java/android/service/euicc/IGetEidCallback.aidl index 35ee9c25a48..e405a981c85 100644 --- a/core/java/android/service/euicc/IGetEidCallback.aidl +++ b/core/java/android/service/euicc/IGetEidCallback.aidl @@ -18,5 +18,6 @@ package android.service.euicc; /** @hide */ oneway interface IGetEidCallback { + @UnsupportedAppUsage void onSuccess(String eid); } \ No newline at end of file diff --git a/core/java/android/service/euicc/IGetEuiccInfoCallback.aidl b/core/java/android/service/euicc/IGetEuiccInfoCallback.aidl index 6d281487602..c0611825ff0 100644 --- a/core/java/android/service/euicc/IGetEuiccInfoCallback.aidl +++ b/core/java/android/service/euicc/IGetEuiccInfoCallback.aidl @@ -20,5 +20,6 @@ import android.telephony.euicc.EuiccInfo; /** @hide */ oneway interface IGetEuiccInfoCallback { + @UnsupportedAppUsage void onSuccess(in EuiccInfo euiccInfo); } \ No newline at end of file diff --git a/core/java/android/service/euicc/IGetEuiccProfileInfoListCallback.aidl b/core/java/android/service/euicc/IGetEuiccProfileInfoListCallback.aidl index 761ec1f0132..0485f7be29d 100644 --- a/core/java/android/service/euicc/IGetEuiccProfileInfoListCallback.aidl +++ b/core/java/android/service/euicc/IGetEuiccProfileInfoListCallback.aidl @@ -20,5 +20,6 @@ import android.service.euicc.GetEuiccProfileInfoListResult; /** @hide */ oneway interface IGetEuiccProfileInfoListCallback { + @UnsupportedAppUsage void onComplete(in GetEuiccProfileInfoListResult result); } \ No newline at end of file diff --git a/core/java/android/service/euicc/IRetainSubscriptionsForFactoryResetCallback.aidl b/core/java/android/service/euicc/IRetainSubscriptionsForFactoryResetCallback.aidl index 127683059c0..340401fe89c 100644 --- a/core/java/android/service/euicc/IRetainSubscriptionsForFactoryResetCallback.aidl +++ b/core/java/android/service/euicc/IRetainSubscriptionsForFactoryResetCallback.aidl @@ -18,5 +18,6 @@ package android.service.euicc; /** @hide */ oneway interface IRetainSubscriptionsForFactoryResetCallback { + @UnsupportedAppUsage void onComplete(int result); } \ No newline at end of file diff --git a/core/java/android/service/euicc/ISwitchToSubscriptionCallback.aidl b/core/java/android/service/euicc/ISwitchToSubscriptionCallback.aidl index 0f91a6b29e2..b8f984d1c28 100644 --- a/core/java/android/service/euicc/ISwitchToSubscriptionCallback.aidl +++ b/core/java/android/service/euicc/ISwitchToSubscriptionCallback.aidl @@ -18,5 +18,6 @@ package android.service.euicc; /** @hide */ oneway interface ISwitchToSubscriptionCallback { + @UnsupportedAppUsage void onComplete(int result); } \ No newline at end of file diff --git a/core/java/android/service/euicc/IUpdateSubscriptionNicknameCallback.aidl b/core/java/android/service/euicc/IUpdateSubscriptionNicknameCallback.aidl index 66669330c8c..0aa66978bb9 100644 --- a/core/java/android/service/euicc/IUpdateSubscriptionNicknameCallback.aidl +++ b/core/java/android/service/euicc/IUpdateSubscriptionNicknameCallback.aidl @@ -18,5 +18,6 @@ package android.service.euicc; /** @hide */ oneway interface IUpdateSubscriptionNicknameCallback { + @UnsupportedAppUsage void onComplete(int result); } \ No newline at end of file diff --git a/core/java/android/service/vr/IVrManager.aidl b/core/java/android/service/vr/IVrManager.aidl index b0269e3325b..a8293b47db3 100644 --- a/core/java/android/service/vr/IVrManager.aidl +++ b/core/java/android/service/vr/IVrManager.aidl @@ -57,6 +57,7 @@ interface IVrManager { * * @return {@code true} if VR mode is enabled. */ + @UnsupportedAppUsage boolean getVrModeState(); /** @@ -93,6 +94,7 @@ interface IVrManager { * @return {@link android.view.Display.INVALID_DISPLAY} if there is no virtual display * currently, else return the display id of the virtual display */ + @UnsupportedAppUsage int getVr2dDisplayId(); /** diff --git a/core/java/android/service/wallpaper/IWallpaperEngine.aidl b/core/java/android/service/wallpaper/IWallpaperEngine.aidl index ebce4846c16..00e0b7c170b 100644 --- a/core/java/android/service/wallpaper/IWallpaperEngine.aidl +++ b/core/java/android/service/wallpaper/IWallpaperEngine.aidl @@ -26,11 +26,15 @@ import android.os.Bundle; oneway interface IWallpaperEngine { void setDesiredSize(int width, int height); void setDisplayPadding(in Rect padding); + @UnsupportedAppUsage void setVisibility(boolean visible); void setInAmbientMode(boolean inAmbientDisplay, long animationDuration); + @UnsupportedAppUsage void dispatchPointer(in MotionEvent event); + @UnsupportedAppUsage void dispatchWallpaperCommand(String action, int x, int y, int z, in Bundle extras); void requestWallpaperColors(); + @UnsupportedAppUsage void destroy(); } diff --git a/keystore/java/android/security/Credentials.java b/keystore/java/android/security/Credentials.java index 2ae28f507e0..08f41766252 100644 --- a/keystore/java/android/security/Credentials.java +++ b/keystore/java/android/security/Credentials.java @@ -20,6 +20,7 @@ import com.android.org.bouncycastle.util.io.pem.PemObject; import com.android.org.bouncycastle.util.io.pem.PemReader; import com.android.org.bouncycastle.util.io.pem.PemWriter; +import android.annotation.UnsupportedAppUsage; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -122,6 +123,7 @@ public class Credentials { * Convert objects to a PEM format which is used for * CA_CERTIFICATE and USER_CERTIFICATE entries. */ + @UnsupportedAppUsage public static byte[] convertToPem(Certificate... objects) throws IOException, CertificateEncodingException { ByteArrayOutputStream bao = new ByteArrayOutputStream(); diff --git a/keystore/java/android/security/IKeyChainService.aidl b/keystore/java/android/security/IKeyChainService.aidl index 0d32075d20d..b3cdff7eedf 100644 --- a/keystore/java/android/security/IKeyChainService.aidl +++ b/keystore/java/android/security/IKeyChainService.aidl @@ -27,6 +27,7 @@ import android.security.keystore.ParcelableKeyGenParameterSpec; */ interface IKeyChainService { // APIs used by KeyChain + @UnsupportedAppUsage String requestPrivateKey(String alias); byte[] getCertificate(String alias); byte[] getCaCertificates(String alias); -- GitLab From cca637a902ac5edabd247dd50a47c41ccd15cf24 Mon Sep 17 00:00:00 2001 From: Richard Uhler Date: Wed, 27 Feb 2019 11:50:48 +0000 Subject: [PATCH 046/398] Have RollbackData reuse RollbackInfo. Rather than duplicating the same information. This is in preparation for storing available and recently committed rollbacks the same way so we don't end up with duplicate copies of PackageRollbackInfo for a rollback so we can fix the bug when doing userdata restore for staged installs. Bug: 124044231 Test: atest RollbackTest Test: atest StagedRollbackTest Test: atest AppDataRollbackHelperTest Change-Id: I6ca164adc4351b778d153d4b33296386f6833b61 --- .../content/rollback/RollbackInfo.java | 18 ++--- .../rollback/AppDataRollbackHelper.java | 6 +- .../android/server/rollback/RollbackData.java | 43 ++++++++---- .../rollback/RollbackManagerServiceImpl.java | 65 ++++++++++--------- .../server/rollback/RollbackStore.java | 32 ++++----- .../rollback/AppDataRollbackHelperTest.java | 16 ++--- 6 files changed, 101 insertions(+), 79 deletions(-) diff --git a/core/java/android/content/rollback/RollbackInfo.java b/core/java/android/content/rollback/RollbackInfo.java index 0cde6ba3809..9459ad366f7 100644 --- a/core/java/android/content/rollback/RollbackInfo.java +++ b/core/java/android/content/rollback/RollbackInfo.java @@ -17,12 +17,10 @@ package android.content.rollback; import android.annotation.SystemApi; -import android.content.pm.PackageInstaller; import android.content.pm.VersionedPackage; import android.os.Parcel; import android.os.Parcelable; -import java.util.Collections; import java.util.List; /** @@ -44,13 +42,7 @@ public final class RollbackInfo implements Parcelable { private final List mCausePackages; private final boolean mIsStaged; - private final int mCommittedSessionId; - - /** @hide */ - public RollbackInfo(int rollbackId, List packages, boolean isStaged) { - this(rollbackId, packages, isStaged, Collections.emptyList(), - PackageInstaller.SessionInfo.INVALID_ID); - } + private int mCommittedSessionId; /** @hide */ public RollbackInfo(int rollbackId, List packages, boolean isStaged, @@ -100,6 +92,14 @@ public final class RollbackInfo implements Parcelable { return mCommittedSessionId; } + /** + * Sets the session ID for the committed rollback for staged rollbacks. + * @hide + */ + public void setCommittedSessionId(int sessionId) { + mCommittedSessionId = sessionId; + } + /** * Gets the list of package versions that motivated this rollback. * As provided to {@link #commitRollback} when the rollback was committed. diff --git a/services/core/java/com/android/server/rollback/AppDataRollbackHelper.java b/services/core/java/com/android/server/rollback/AppDataRollbackHelper.java index e9ccea54fe9..36f18f05c23 100644 --- a/services/core/java/com/android/server/rollback/AppDataRollbackHelper.java +++ b/services/core/java/com/android/server/rollback/AppDataRollbackHelper.java @@ -166,7 +166,7 @@ public class AppDataRollbackHelper { List rd = new ArrayList<>(); for (RollbackData data : availableRollbacks) { - for (PackageRollbackInfo info : data.packages) { + for (PackageRollbackInfo info : data.info.getPackages()) { final IntArray pendingBackupUsers = info.getPendingBackups(); if (pendingBackupUsers != null) { final int idx = pendingBackupUsers.indexOf(userId); @@ -246,13 +246,13 @@ public class AppDataRollbackHelper { if (!pendingBackupPackages.isEmpty()) { for (RollbackData data : pendingBackups) { - for (PackageRollbackInfo info : data.packages) { + for (PackageRollbackInfo info : data.info.getPackages()) { final IntArray pendingBackupUsers = info.getPendingBackups(); final int idx = pendingBackupUsers.indexOf(userId); if (idx != -1) { try { long ceSnapshotInode = mInstaller.snapshotAppData(info.getPackageName(), - userId, data.rollbackId, Installer.FLAG_STORAGE_CE); + userId, data.info.getRollbackId(), Installer.FLAG_STORAGE_CE); info.putCeSnapshotInode(userId, ceSnapshotInode); pendingBackupUsers.remove(idx); } catch (InstallerException ie) { diff --git a/services/core/java/com/android/server/rollback/RollbackData.java b/services/core/java/com/android/server/rollback/RollbackData.java index bad3963f993..655bf4ab57a 100644 --- a/services/core/java/com/android/server/rollback/RollbackData.java +++ b/services/core/java/com/android/server/rollback/RollbackData.java @@ -16,12 +16,11 @@ package com.android.server.rollback; -import android.content.rollback.PackageRollbackInfo; +import android.content.rollback.RollbackInfo; import java.io.File; import java.time.Instant; import java.util.ArrayList; -import java.util.List; /** * Information about a rollback available for a set of atomically installed @@ -29,14 +28,9 @@ import java.util.List; */ class RollbackData { /** - * A unique identifier for this rollback. + * The rollback info for this rollback. */ - public final int rollbackId; - - /** - * The per-package rollback information. - */ - public final List packages = new ArrayList<>(); + public final RollbackInfo info; /** * The directory where the rollback data is stored. @@ -76,17 +70,42 @@ class RollbackData { // NOTE: All accesses to this field are from the RollbackManager handler thread. public boolean restoreUserDataInProgress = false; - RollbackData(int rollbackId, File backupDir, int stagedSessionId, boolean isAvailable) { - this.rollbackId = rollbackId; + /** + * Constructs a new, empty RollbackData instance. + * + * @param rollbackId the id of the rollback. + * @param backupDir the directory where the rollback data is stored. + * @param stagedSessionId the session id if this is a staged rollback, -1 otherwise. + */ + RollbackData(int rollbackId, File backupDir, int stagedSessionId) { + this.info = new RollbackInfo(rollbackId, + /* packages */ new ArrayList<>(), + /* isStaged */ stagedSessionId != -1, + /* causePackages */ new ArrayList<>(), + /* committedSessionId */ -1); + this.backupDir = backupDir; + this.stagedSessionId = stagedSessionId; + this.isAvailable = (stagedSessionId == -1); + } + + /** + * Constructs a RollbackData instance with full rollback data information. + */ + RollbackData(RollbackInfo info, File backupDir, Instant timestamp, int stagedSessionId, + boolean isAvailable, int apkSessionId, boolean restoreUserDataInProgress) { + this.info = info; this.backupDir = backupDir; + this.timestamp = timestamp; this.stagedSessionId = stagedSessionId; this.isAvailable = isAvailable; + this.apkSessionId = apkSessionId; + this.restoreUserDataInProgress = restoreUserDataInProgress; } /** * Whether the rollback is for rollback of a staged install. */ public boolean isStaged() { - return stagedSessionId != -1; + return info.isStaged(); } } diff --git a/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java b/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java index 767f56a8a3b..3e42b32f9a6 100644 --- a/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java +++ b/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java @@ -243,8 +243,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { for (int i = 0; i < mAvailableRollbacks.size(); ++i) { RollbackData data = mAvailableRollbacks.get(i); if (data.isAvailable) { - rollbacks.add(new RollbackInfo(data.rollbackId, - data.packages, data.isStaged())); + rollbacks.add(data.info); } } return new ParceledListSlice<>(rollbacks); @@ -301,8 +300,8 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { } catch (IOException ioe) { // TODO: figure out the right way to deal with this, especially if // it fails for some data and succeeds for others. - Log.e(TAG, "Unable to save rollback info for : " + data.rollbackId, - ioe); + Log.e(TAG, "Unable to save rollback info for : " + + data.info.getRollbackId(), ioe); } } @@ -349,7 +348,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { // rollback racing with a roll-forward fix of a buggy package. // Figure out how to ensure we don't commit the rollback if // roll forward happens at the same time. - for (PackageRollbackInfo info : data.packages) { + for (PackageRollbackInfo info : data.info.getPackages()) { VersionedPackage installedVersion = getInstalledPackageVersion(info.getPackageName()); if (installedVersion == null) { // TODO: Test this case @@ -391,7 +390,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { int parentSessionId = packageInstaller.createSession(parentParams); PackageInstaller.Session parentSession = packageInstaller.openSession(parentSessionId); - for (PackageRollbackInfo info : data.packages) { + for (PackageRollbackInfo info : data.info.getPackages()) { PackageInstaller.SessionParams params = new PackageInstaller.SessionParams( PackageInstaller.SessionParams.MODE_FULL_INSTALL); // TODO: We can't get the installerPackageName for apex @@ -453,9 +452,9 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { return; } - addRecentlyExecutedRollback(new RollbackInfo( - data.rollbackId, data.packages, data.isStaged(), - causePackages, parentSessionId)); + data.info.setCommittedSessionId(parentSessionId); + data.info.getCausePackages().addAll(causePackages); + addRecentlyExecutedRollback(data.info); sendSuccess(statusReceiver); Intent broadcast = new Intent(Intent.ACTION_ROLLBACK_COMMITTED); @@ -510,7 +509,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { Iterator iter = mAvailableRollbacks.iterator(); while (iter.hasNext()) { RollbackData data = iter.next(); - for (PackageRollbackInfo info : data.packages) { + for (PackageRollbackInfo info : data.info.getPackages()) { if (info.getPackageName().equals(packageName)) { iter.remove(); deleteRollback(data); @@ -539,7 +538,8 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { try { mRollbackStore.saveAvailableRollback(rd); } catch (IOException ioe) { - Log.e(TAG, "Unable to save rollback info for : " + rd.rollbackId, ioe); + Log.e(TAG, "Unable to save rollback info for : " + + rd.info.getRollbackId(), ioe); } } @@ -575,7 +575,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { synchronized (mLock) { ensureRollbackDataLoadedLocked(); for (RollbackData data : mAvailableRollbacks) { - if (data.stagedSessionId != -1) { + if (!data.isAvailable && data.isStaged()) { staged.add(data); } } @@ -594,7 +594,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { mRollbackStore.saveAvailableRollback(data); } catch (IOException ioe) { Log.e(TAG, "Unable to save rollback info for : " - + data.rollbackId, ioe); + + data.info.getRollbackId(), ioe); } } else if (session.isStagedSessionFailed()) { // TODO: Do we need to remove this from @@ -641,7 +641,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { private void loadAllRollbackDataLocked() { mAvailableRollbacks = mRollbackStore.loadAvailableRollbacks(); for (RollbackData data : mAvailableRollbacks) { - mAllocatedRollbackIds.put(data.rollbackId, true); + mAllocatedRollbackIds.put(data.info.getRollbackId(), true); } mRecentlyExecutedRollbacks = mRollbackStore.loadRecentlyExecutedRollbacks(); @@ -665,7 +665,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { Iterator iter = mAvailableRollbacks.iterator(); while (iter.hasNext()) { RollbackData data = iter.next(); - for (PackageRollbackInfo info : data.packages) { + for (PackageRollbackInfo info : data.info.getPackages()) { if (info.getPackageName().equals(packageName) && !packageVersionsEqual( info.getVersionRolledBackFrom(), @@ -897,10 +897,10 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { return false; } String packageName = newPackage.packageName; - for (PackageRollbackInfo info : rd.packages) { + for (PackageRollbackInfo info : rd.info.getPackages()) { if (info.getPackageName().equals(packageName)) { info.getInstalledUsers().addAll(IntArray.wrap(installedUsers)); - mAppDataRollbackHelper.snapshotAppData(rd.rollbackId, info); + mAppDataRollbackHelper.snapshotAppData(rd.info.getRollbackId(), info); try { mRollbackStore.saveAvailableRollback(rd); } catch (IOException ioe) { @@ -908,7 +908,8 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { // again to save the rollback when the staged session // is applied. Just so long as the device doesn't // reboot before then. - Log.e(TAG, "Unable to save rollback info for : " + rd.rollbackId, ioe); + Log.e(TAG, "Unable to save rollback info for : " + + rd.info.getRollbackId(), ioe); } return true; } @@ -989,14 +990,13 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { if (data == null) { int rollbackId = allocateRollbackIdLocked(); if (session.isStaged()) { - data = mRollbackStore.createPendingStagedRollback(rollbackId, - parentSessionId); + data = mRollbackStore.createStagedRollback(rollbackId, parentSessionId); } else { - data = mRollbackStore.createAvailableRollback(rollbackId); + data = mRollbackStore.createNonStagedRollback(rollbackId); } mPendingRollbacks.put(parentSessionId, data); } - data.packages.add(info); + data.info.getPackages().add(info); } } catch (IOException e) { Log.e(TAG, "Unable to create rollback for " + packageName, e); @@ -1004,7 +1004,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { } if (snapshotUserData && !isApex) { - mAppDataRollbackHelper.snapshotAppData(data.rollbackId, info); + mAppDataRollbackHelper.snapshotAppData(data.info.getRollbackId(), info); } try { @@ -1053,7 +1053,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { for (int userId : userIds) { final PackageRollbackInfo info = getPackageRollbackInfo(rollbackData, packageName); final boolean changedRollbackData = mAppDataRollbackHelper.restoreAppData( - rollbackData.rollbackId, info, userId, appId, seInfo); + rollbackData.info.getRollbackId(), info, userId, appId, seInfo); // We've updated metadata about this rollback, so save it to flash. if (changedRollbackData) { @@ -1139,7 +1139,8 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { try { mRollbackStore.saveAvailableRollback(rd); } catch (IOException ioe) { - Log.e(TAG, "Unable to save rollback info for : " + rd.rollbackId, ioe); + Log.e(TAG, "Unable to save rollback info for : " + + rd.info.getRollbackId(), ioe); } } }); @@ -1233,8 +1234,8 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { // After enabling and commiting any rollback, observe packages and // prepare to rollback if packages crashes too frequently. List packages = new ArrayList<>(); - for (int i = 0; i < data.packages.size(); i++) { - packages.add(data.packages.get(i).getPackageName()); + for (int i = 0; i < data.info.getPackages().size(); i++) { + packages.add(data.info.getPackages().get(i).getPackageName()); } mPackageHealthObserver.startObservingHealth(packages, mRollbackLifetimeDurationInMillis); @@ -1307,7 +1308,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { ensureRollbackDataLoadedLocked(); for (int i = 0; i < mAvailableRollbacks.size(); ++i) { RollbackData data = mAvailableRollbacks.get(i); - if (data.isAvailable && data.rollbackId == rollbackId) { + if (data.isAvailable && data.info.getRollbackId() == rollbackId) { return data; } } @@ -1322,7 +1323,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { */ private static PackageRollbackInfo getPackageRollbackInfo(RollbackData data, String packageName) { - for (PackageRollbackInfo info : data.packages) { + for (PackageRollbackInfo info : data.info.getPackages()) { if (info.getPackageName().equals(packageName)) { return info; } @@ -1347,12 +1348,12 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { } private void deleteRollback(RollbackData rollbackData) { - for (PackageRollbackInfo info : rollbackData.packages) { + for (PackageRollbackInfo info : rollbackData.info.getPackages()) { IntArray installedUsers = info.getInstalledUsers(); for (int i = 0; i < installedUsers.size(); i++) { int userId = installedUsers.get(i); - mAppDataRollbackHelper.destroyAppDataSnapshot(rollbackData.rollbackId, info, - userId); + mAppDataRollbackHelper.destroyAppDataSnapshot(rollbackData.info.getRollbackId(), + info, userId); } } mRollbackStore.deleteAvailableRollback(rollbackData); diff --git a/services/core/java/com/android/server/rollback/RollbackStore.java b/services/core/java/com/android/server/rollback/RollbackStore.java index 23defadf542..b4cc6e46950 100644 --- a/services/core/java/com/android/server/rollback/RollbackStore.java +++ b/services/core/java/com/android/server/rollback/RollbackStore.java @@ -229,17 +229,22 @@ class RollbackStore { } /** - * Creates a new RollbackData instance with backupDir assigned. + * Creates a new RollbackData instance for a non-staged rollback with + * backupDir assigned. */ - RollbackData createAvailableRollback(int rollbackId) throws IOException { + RollbackData createNonStagedRollback(int rollbackId) throws IOException { File backupDir = new File(mAvailableRollbacksDir, Integer.toString(rollbackId)); - return new RollbackData(rollbackId, backupDir, -1, true); + return new RollbackData(rollbackId, backupDir, -1); } - RollbackData createPendingStagedRollback(int rollbackId, int stagedSessionId) + /** + * Creates a new RollbackData instance for a staged rollback with + * backupDir assigned. + */ + RollbackData createStagedRollback(int rollbackId, int stagedSessionId) throws IOException { File backupDir = new File(mAvailableRollbacksDir, Integer.toString(rollbackId)); - return new RollbackData(rollbackId, backupDir, stagedSessionId, false); + return new RollbackData(rollbackId, backupDir, stagedSessionId); } /** @@ -277,8 +282,7 @@ class RollbackStore { void saveAvailableRollback(RollbackData data) throws IOException { try { JSONObject dataJson = new JSONObject(); - dataJson.put("rollbackId", data.rollbackId); - dataJson.put("packages", toJson(data.packages)); + dataJson.put("info", rollbackInfoToJson(data.info)); dataJson.put("timestamp", data.timestamp.toString()); dataJson.put("stagedSessionId", data.stagedSessionId); dataJson.put("isAvailable", data.isAvailable); @@ -334,16 +338,14 @@ class RollbackStore { JSONObject dataJson = new JSONObject( IoUtils.readFileAsString(rollbackJsonFile.getAbsolutePath())); - RollbackData data = new RollbackData( - dataJson.getInt("rollbackId"), + return new RollbackData( + rollbackInfoFromJson(dataJson.getJSONObject("info")), backupDir, + Instant.parse(dataJson.getString("timestamp")), dataJson.getInt("stagedSessionId"), - dataJson.getBoolean("isAvailable")); - data.packages.addAll(packageRollbackInfosFromJson(dataJson.getJSONArray("packages"))); - data.timestamp = Instant.parse(dataJson.getString("timestamp")); - data.apkSessionId = dataJson.getInt("apkSessionId"); - data.restoreUserDataInProgress = dataJson.getBoolean("restoreUserDataInProgress"); - return data; + dataJson.getBoolean("isAvailable"), + dataJson.getInt("apkSessionId"), + dataJson.getBoolean("restoreUserDataInProgress")); } catch (JSONException | DateTimeParseException e) { throw new IOException(e); } diff --git a/services/tests/servicestests/src/com/android/server/rollback/AppDataRollbackHelperTest.java b/services/tests/servicestests/src/com/android/server/rollback/AppDataRollbackHelperTest.java index d848b2dc75f..fc7ccc576ab 100644 --- a/services/tests/servicestests/src/com/android/server/rollback/AppDataRollbackHelperTest.java +++ b/services/tests/servicestests/src/com/android/server/rollback/AppDataRollbackHelperTest.java @@ -236,20 +236,20 @@ public class AppDataRollbackHelperTest { wasRecentlyRestored.getPendingRestores().add( new RestoreInfo(73 /* userId */, 239 /* appId*/, "seInfo")); - RollbackData dataWithPendingBackup = new RollbackData(101, new File("/does/not/exist"), -1, - true); - dataWithPendingBackup.packages.add(pendingBackup); + RollbackData dataWithPendingBackup = new RollbackData(101, new File("/does/not/exist"), -1); + dataWithPendingBackup.info.getPackages().add(pendingBackup); RollbackData dataWithRecentRestore = new RollbackData(17239, new File("/does/not/exist"), - -1, true); - dataWithRecentRestore.packages.add(wasRecentlyRestored); + -1); + dataWithRecentRestore.info.getPackages().add(wasRecentlyRestored); RollbackData dataForDifferentUser = new RollbackData(17239, new File("/does/not/exist"), - -1, true); - dataForDifferentUser.packages.add(ignoredInfo); + -1); + dataForDifferentUser.info.getPackages().add(ignoredInfo); RollbackInfo rollbackInfo = new RollbackInfo(17239, - Arrays.asList(pendingRestore, wasRecentlyRestored), false); + Arrays.asList(pendingRestore, wasRecentlyRestored), false, + new ArrayList<>(), -1); List changed = helper.commitPendingBackupAndRestoreForUser(37, Arrays.asList(dataWithPendingBackup, dataWithRecentRestore, dataForDifferentUser), -- GitLab From aad02c073ba32d8e51f97ab32d7f272cb685e54e Mon Sep 17 00:00:00 2001 From: Richard Uhler Date: Wed, 27 Feb 2019 12:57:20 +0000 Subject: [PATCH 047/398] Rename saveAvailableRollback to saveRollbackData. And rename deleteAvailableRollback to deleteRollbackData. In preparation for using these functions for both available and committed rollback data. Bug: 124044231 Test: builds Change-Id: Iae43f695ba7d2f58e687b491bd988ef1ae7026b6 --- .../rollback/RollbackManagerServiceImpl.java | 16 ++++++++-------- .../android/server/rollback/RollbackStore.java | 9 ++++----- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java b/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java index 3e42b32f9a6..52d441255da 100644 --- a/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java +++ b/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java @@ -296,7 +296,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { data.timestamp = data.timestamp.plusMillis(timeDifference); try { - mRollbackStore.saveAvailableRollback(data); + mRollbackStore.saveRollbackData(data); } catch (IOException ioe) { // TODO: figure out the right way to deal with this, especially if // it fails for some data and succeeds for others. @@ -536,7 +536,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { for (RollbackData rd : changed) { try { - mRollbackStore.saveAvailableRollback(rd); + mRollbackStore.saveRollbackData(rd); } catch (IOException ioe) { Log.e(TAG, "Unable to save rollback info for : " + rd.info.getRollbackId(), ioe); @@ -591,7 +591,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { data.isAvailable = true; } try { - mRollbackStore.saveAvailableRollback(data); + mRollbackStore.saveRollbackData(data); } catch (IOException ioe) { Log.e(TAG, "Unable to save rollback info for : " + data.info.getRollbackId(), ioe); @@ -902,7 +902,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { info.getInstalledUsers().addAll(IntArray.wrap(installedUsers)); mAppDataRollbackHelper.snapshotAppData(rd.info.getRollbackId(), info); try { - mRollbackStore.saveAvailableRollback(rd); + mRollbackStore.saveRollbackData(rd); } catch (IOException ioe) { // TODO: Hopefully this is okay because we will try // again to save the rollback when the staged session @@ -1058,7 +1058,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { // We've updated metadata about this rollback, so save it to flash. if (changedRollbackData) { try { - mRollbackStore.saveAvailableRollback(rollbackData); + mRollbackStore.saveRollbackData(rollbackData); } catch (IOException ioe) { // TODO(narayan): What is the right thing to do here ? This isn't a fatal // error, since it will only result in us trying to restore data again, @@ -1137,7 +1137,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { if (rd != null) { try { - mRollbackStore.saveAvailableRollback(rd); + mRollbackStore.saveRollbackData(rd); } catch (IOException ioe) { Log.e(TAG, "Unable to save rollback info for : " + rd.info.getRollbackId(), ioe); @@ -1213,7 +1213,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { try { data.timestamp = Instant.now(); - mRollbackStore.saveAvailableRollback(data); + mRollbackStore.saveRollbackData(data); synchronized (mLock) { // Note: There is a small window of time between when // the session has been committed by the package @@ -1356,6 +1356,6 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { info, userId); } } - mRollbackStore.deleteAvailableRollback(rollbackData); + mRollbackStore.deleteRollbackData(rollbackData); } } diff --git a/services/core/java/com/android/server/rollback/RollbackStore.java b/services/core/java/com/android/server/rollback/RollbackStore.java index b4cc6e46950..ecdb2ccd872 100644 --- a/services/core/java/com/android/server/rollback/RollbackStore.java +++ b/services/core/java/com/android/server/rollback/RollbackStore.java @@ -277,9 +277,9 @@ class RollbackStore { } /** - * Writes the metadata for an available rollback to persistent storage. + * Saves the rollback data to persistent storage. */ - void saveAvailableRollback(RollbackData data) throws IOException { + void saveRollbackData(RollbackData data) throws IOException { try { JSONObject dataJson = new JSONObject(); dataJson.put("info", rollbackInfoToJson(data.info)); @@ -298,10 +298,9 @@ class RollbackStore { } /** - * Removes all persistant storage associated with the given available - * rollback. + * Removes all persistant storage associated with the given rollback data. */ - void deleteAvailableRollback(RollbackData data) { + void deleteRollbackData(RollbackData data) { removeFile(data.backupDir); } -- GitLab From d6eb5a293b92c088c655b699b13949f8d01e9081 Mon Sep 17 00:00:00 2001 From: Issei Suzuki Date: Wed, 20 Feb 2019 23:08:03 +0100 Subject: [PATCH 048/398] Fix a bug that an activity occluding the keygaurd keeps running behind AOD. Test: test android.server.am.KeyguardTests Bug: 123150006 Bug: 122263738 Bug: 124428337 Change-Id: If364e03083e3aea43fbe1bd88cd8089d925b5e98 --- .../server/activitymanagerservice.proto | 1 + .../android/server/wm/KeyguardController.java | 21 +++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/core/proto/android/server/activitymanagerservice.proto b/core/proto/android/server/activitymanagerservice.proto index 6f9a5649d4a..79a5dd78ffb 100644 --- a/core/proto/android/server/activitymanagerservice.proto +++ b/core/proto/android/server/activitymanagerservice.proto @@ -132,6 +132,7 @@ message KeyguardControllerProto { optional bool keyguard_showing = 1; repeated KeyguardOccludedProto keyguard_occluded_states= 2; + optional bool aod_showing = 3; } message KeyguardOccludedProto { diff --git a/services/core/java/com/android/server/wm/KeyguardController.java b/services/core/java/com/android/server/wm/KeyguardController.java index feb711abaea..8c8b05f1307 100644 --- a/services/core/java/com/android/server/wm/KeyguardController.java +++ b/services/core/java/com/android/server/wm/KeyguardController.java @@ -29,6 +29,7 @@ import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_TO_SHADE; import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER; +import static com.android.server.am.KeyguardControllerProto.AOD_SHOWING; import static com.android.server.am.KeyguardControllerProto.KEYGUARD_OCCLUDED_STATES; import static com.android.server.am.KeyguardControllerProto.KEYGUARD_SHOWING; import static com.android.server.am.KeyguardOccludedProto.DISPLAY_ID; @@ -86,13 +87,23 @@ class KeyguardController { /** * @return true if either Keyguard or AOD are showing, not going away, and not being occluded - * on the given display, false otherwise + * on the given display, false otherwise. */ boolean isKeyguardOrAodShowing(int displayId) { return (mKeyguardShowing || mAodShowing) && !mKeyguardGoingAway && !isDisplayOccluded(displayId); } + /** + * @return {@code true} if 1) Keyguard is showing, not going away, and not being occluded on the + * given display, or 2) AOD is showing, {@code false} otherwise. + * TODO(b/125198167): Replace isKeyguardOrAodShowing() by this logic. + */ + boolean isKeyguardUnoccludedOrAodShowing(int displayId) { + return (mKeyguardShowing && !mKeyguardGoingAway && !isDisplayOccluded(displayId)) + || mAodShowing; + } + /** * @return true if Keyguard is showing, not going away, and not being occluded on the given * display, false otherwise @@ -380,10 +391,11 @@ class KeyguardController { for (int displayNdx = mRootActivityContainer.getChildCount() - 1; displayNdx >= 0; displayNdx--) { final ActivityDisplay display = mRootActivityContainer.getChildAt(displayNdx); - final KeyguardDisplayState state = getDisplay(display.mDisplayId); - if (isKeyguardOrAodShowing(display.mDisplayId) && state.mSleepToken == null) { + final int displayId = display.mDisplayId; + final KeyguardDisplayState state = getDisplay(displayId); + if (isKeyguardUnoccludedOrAodShowing(displayId) && state.mSleepToken == null) { state.acquiredSleepToken(); - } else if (!isKeyguardOrAodShowing(display.mDisplayId) && state.mSleepToken != null) { + } else if (!isKeyguardUnoccludedOrAodShowing(displayId) && state.mSleepToken != null) { state.releaseSleepToken(); } } @@ -528,6 +540,7 @@ class KeyguardController { void writeToProto(ProtoOutputStream proto, long fieldId) { final long token = proto.start(fieldId); + proto.write(AOD_SHOWING, mAodShowing); proto.write(KEYGUARD_SHOWING, mKeyguardShowing); writeDisplayStatesToProto(proto, KEYGUARD_OCCLUDED_STATES); proto.end(token); -- GitLab From 8c835785c374048f58a3daa9a3db3a4c72b37db6 Mon Sep 17 00:00:00 2001 From: Nadia Benbernou Date: Wed, 27 Feb 2019 11:42:13 -0500 Subject: [PATCH 049/398] Add maxWidths to text views for blocking helper buttons. Also tighten char limits to avoid wrapping when possible. Bug:123619899 Test: Verified text wraps appropriately in Serbian and French. Change-Id: I295133436128929e18c22ede69bdf055a8e44c78 --- packages/SystemUI/res/layout/notification_info.xml | 5 +++++ packages/SystemUI/res/values/strings.xml | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/res/layout/notification_info.xml b/packages/SystemUI/res/layout/notification_info.xml index 91353d7fb8b..863c1ccd7ea 100644 --- a/packages/SystemUI/res/layout/notification_info.xml +++ b/packages/SystemUI/res/layout/notification_info.xml @@ -178,6 +178,7 @@ asked for it --> android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" + android:maxWidth="100dp" style="@style/TextAppearance.NotificationInfo.Button"/> android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_alignParentEnd="true" + android:maxWidth="200dp" android:orientation="horizontal"> android:layout_centerVertical="true" android:layout_marginStart="@dimen/notification_guts_button_horizontal_spacing" android:paddingRight="24dp" + android:maxWidth="125dp" style="@style/TextAppearance.NotificationInfo.Button"/> android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" + android:maxWidth="75dp" android:layout_marginStart="@dimen/notification_guts_button_horizontal_spacing" style="@style/TextAppearance.NotificationInfo.Button"/> android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" + android:maxWidth="75dp" android:layout_marginStart="@dimen/notification_guts_button_horizontal_spacing" style="@style/TextAppearance.NotificationInfo.Button"/> diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 4905e572af1..d53c78543b6 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -1579,7 +1579,7 @@ You usually dismiss these notifications. \nKeep showing them? - + Done @@ -1588,7 +1588,7 @@ Stop notifications - + Deliver Silently -- GitLab From fa152f9517c42685c11cbe6e517c203adb43a549 Mon Sep 17 00:00:00 2001 From: Andrei Onea Date: Wed, 27 Feb 2019 15:58:05 +0000 Subject: [PATCH 050/398] Add @UnsupportedAppUsage annotations For packages: com.android.internal.app com.android.internal.appwidget com.android.internal.location com.android.internal.os com.android.internal.policy com.android.internal.statusbar com.android.internal.telecom com.android.internal.telephony com.android.internal.widget This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: I6eba34467b2492047e5264684312adfa029eb317 --- config/hiddenapi-greylist.txt | 77 ------------------- .../android/internal/app/IAppOpsService.aidl | 5 ++ .../android/internal/app/IBatteryStats.aidl | 4 + .../app/IVoiceInteractionManagerService.aidl | 1 + .../internal/appwidget/IAppWidgetService.aidl | 4 + .../internal/os/IDropBoxManagerService.aidl | 1 + .../internal/policy/IKeyguardService.aidl | 2 + .../internal/statusbar/IStatusBarService.aidl | 6 ++ .../internal/widget/ILockSettings.aidl | 8 ++ .../internal/widget/IRemoteViewsFactory.aidl | 8 ++ .../internal/location/ILocationProvider.aidl | 2 + .../location/ILocationProviderManager.aidl | 3 + .../internal/telecom/ITelecomService.aidl | 1 + .../telephony/ICarrierConfigLoader.aidl | 1 + .../internal/telephony/IPhoneSubInfo.aidl | 2 + .../internal/telephony/ITelephony.aidl | 22 ++++++ .../telephony/ITelephonyRegistry.aidl | 4 + .../internal/telephony/IWapPushManager.aidl | 3 + 18 files changed, 77 insertions(+), 77 deletions(-) diff --git a/config/hiddenapi-greylist.txt b/config/hiddenapi-greylist.txt index e25f463a944..5d021aa7c8f 100644 --- a/config/hiddenapi-greylist.txt +++ b/config/hiddenapi-greylist.txt @@ -1688,22 +1688,12 @@ Lcom/android/internal/app/IAppOpsService$Stub;->TRANSACTION_setUserRestrictions: Lcom/android/internal/app/IAppOpsService$Stub;->TRANSACTION_startOperation:I Lcom/android/internal/app/IAppOpsService$Stub;->TRANSACTION_startWatchingMode:I Lcom/android/internal/app/IAppOpsService$Stub;->TRANSACTION_stopWatchingMode:I -Lcom/android/internal/app/IAppOpsService;->finishOperation(Landroid/os/IBinder;IILjava/lang/String;)V -Lcom/android/internal/app/IAppOpsService;->getOpsForPackage(ILjava/lang/String;[I)Ljava/util/List; -Lcom/android/internal/app/IAppOpsService;->getPackagesForOps([I)Ljava/util/List; -Lcom/android/internal/app/IAppOpsService;->resetAllModes(ILjava/lang/String;)V -Lcom/android/internal/app/IAppOpsService;->setMode(IILjava/lang/String;I)V Lcom/android/internal/app/IBatteryStats$Stub$Proxy;->(Landroid/os/IBinder;)V Lcom/android/internal/app/IBatteryStats$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/app/IBatteryStats; -Lcom/android/internal/app/IBatteryStats;->computeChargeTimeRemaining()J -Lcom/android/internal/app/IBatteryStats;->getAwakeTimeBattery()J -Lcom/android/internal/app/IBatteryStats;->getStatistics()[B -Lcom/android/internal/app/IBatteryStats;->isCharging()Z Lcom/android/internal/app/IMediaContainerService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/app/IMediaContainerService; Lcom/android/internal/app/IntentForwarderActivity;->TAG:Ljava/lang/String; Lcom/android/internal/app/IVoiceInteractionManagerService$Stub$Proxy;->showSessionFromSession(Landroid/os/IBinder;Landroid/os/Bundle;I)Z Lcom/android/internal/app/IVoiceInteractionManagerService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/app/IVoiceInteractionManagerService; -Lcom/android/internal/app/IVoiceInteractionManagerService;->getKeyphraseSoundModel(ILjava/lang/String;)Landroid/hardware/soundtrigger/SoundTrigger$KeyphraseSoundModel; Lcom/android/internal/app/LocaleHelper$LocaleInfoComparator;->(Ljava/util/Locale;Z)V Lcom/android/internal/app/LocaleHelper$LocaleInfoComparator;->compare(Lcom/android/internal/app/LocaleStore$LocaleInfo;Lcom/android/internal/app/LocaleStore$LocaleInfo;)I Lcom/android/internal/app/LocaleHelper;->getDisplayCountry(Ljava/util/Locale;Ljava/util/Locale;)Ljava/lang/String; @@ -1731,10 +1721,6 @@ Lcom/android/internal/app/WindowDecorActionBar;->mTabScrollView:Lcom/android/int Lcom/android/internal/app/WindowDecorActionBar;->setShowHideAnimationEnabled(Z)V Lcom/android/internal/appwidget/IAppWidgetService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/appwidget/IAppWidgetService; Lcom/android/internal/appwidget/IAppWidgetService$Stub;->TRANSACTION_bindAppWidgetId:I -Lcom/android/internal/appwidget/IAppWidgetService;->bindAppWidgetId(Ljava/lang/String;IILandroid/content/ComponentName;Landroid/os/Bundle;)Z -Lcom/android/internal/appwidget/IAppWidgetService;->bindRemoteViewsService(Ljava/lang/String;ILandroid/content/Intent;Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/app/IServiceConnection;I)Z -Lcom/android/internal/appwidget/IAppWidgetService;->getAppWidgetIds(Landroid/content/ComponentName;)[I -Lcom/android/internal/appwidget/IAppWidgetService;->getAppWidgetViews(Ljava/lang/String;I)Landroid/widget/RemoteViews; Lcom/android/internal/backup/IBackupTransport$Stub;->()V Lcom/android/internal/content/PackageMonitor;->()V Lcom/android/internal/database/SortCursor;->([Landroid/database/Cursor;Ljava/lang/String;)V @@ -1751,16 +1737,11 @@ Lcom/android/internal/location/GpsNetInitiatedHandler;->handleNiNotification(Lco Lcom/android/internal/location/GpsNetInitiatedHandler;->mIsHexInput:Z Lcom/android/internal/location/ILocationProvider$Stub;->()V Lcom/android/internal/location/ILocationProvider$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/location/ILocationProvider; -Lcom/android/internal/location/ILocationProvider;->getStatus(Landroid/os/Bundle;)I -Lcom/android/internal/location/ILocationProvider;->getStatusUpdateTime()J Lcom/android/internal/location/ILocationProvider;->sendExtraCommand(Ljava/lang/String;Landroid/os/Bundle;)V Lcom/android/internal/location/ILocationProvider;->setLocationProviderManager(Lcom/android/internal/location/ILocationProviderManager;)V Lcom/android/internal/location/ILocationProvider;->setRequest(Lcom/android/internal/location/ProviderRequest;Landroid/os/WorkSource;)V Lcom/android/internal/location/ILocationProviderManager$Stub;->()V Lcom/android/internal/location/ILocationProviderManager$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/location/ILocationProviderManager; -Lcom/android/internal/location/ILocationProviderManager;->onReportLocation(Landroid/location/Location;)V -Lcom/android/internal/location/ILocationProviderManager;->onSetEnabled(Z)V -Lcom/android/internal/location/ILocationProviderManager;->onSetProperties(Lcom/android/internal/location/ProviderProperties;)V Lcom/android/internal/logging/MetricsLogger;->()V Lcom/android/internal/net/LegacyVpnInfo;->()V Lcom/android/internal/net/VpnConfig;->()V @@ -1772,7 +1753,6 @@ Lcom/android/internal/os/BinderInternal;->getContextObject()Landroid/os/IBinder; Lcom/android/internal/os/BinderInternal;->handleGc()V Lcom/android/internal/os/ClassLoaderFactory;->createClassloaderNamespace(Ljava/lang/ClassLoader;ILjava/lang/String;Ljava/lang/String;ZZ)Ljava/lang/String; Lcom/android/internal/os/IDropBoxManagerService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/os/IDropBoxManagerService; -Lcom/android/internal/os/IDropBoxManagerService;->getNextEntry(Ljava/lang/String;JLjava/lang/String;)Landroid/os/DropBoxManager$Entry; Lcom/android/internal/os/ProcessCpuTracker$Stats;->name:Ljava/lang/String; Lcom/android/internal/os/ProcessCpuTracker$Stats;->rel_stime:I Lcom/android/internal/os/ProcessCpuTracker$Stats;->rel_uptime:J @@ -1798,8 +1778,6 @@ Lcom/android/internal/policy/DecorView;->mLastLeftInset:I Lcom/android/internal/policy/DecorView;->mLastRightInset:I Lcom/android/internal/policy/DecorView;->mWindow:Lcom/android/internal/policy/PhoneWindow; Lcom/android/internal/policy/IKeyguardService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/policy/IKeyguardService; -Lcom/android/internal/policy/IKeyguardService;->doKeyguardTimeout(Landroid/os/Bundle;)V -Lcom/android/internal/policy/IKeyguardService;->setKeyguardEnabled(Z)V Lcom/android/internal/policy/IKeyguardStateCallback$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/policy/IKeyguardStateCallback; Lcom/android/internal/policy/PhoneFallbackEventHandler;->(Landroid/content/Context;)V Lcom/android/internal/policy/PhoneFallbackEventHandler;->mContext:Landroid/content/Context; @@ -2253,14 +2231,7 @@ Lcom/android/internal/R$xml;->power_profile:I Lcom/android/internal/statusbar/IStatusBar$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/statusbar/IStatusBar; Lcom/android/internal/statusbar/IStatusBarService$Stub;->()V Lcom/android/internal/statusbar/IStatusBarService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/statusbar/IStatusBarService; -Lcom/android/internal/statusbar/IStatusBarService;->collapsePanels()V -Lcom/android/internal/statusbar/IStatusBarService;->disable(ILandroid/os/IBinder;Ljava/lang/String;)V -Lcom/android/internal/statusbar/IStatusBarService;->expandNotificationsPanel()V -Lcom/android/internal/statusbar/IStatusBarService;->handleSystemKey(I)V -Lcom/android/internal/statusbar/IStatusBarService;->removeIcon(Ljava/lang/String;)V -Lcom/android/internal/statusbar/IStatusBarService;->setIconVisibility(Ljava/lang/String;Z)V Lcom/android/internal/telecom/ITelecomService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/telecom/ITelecomService; -Lcom/android/internal/telecom/ITelecomService;->getCallState()I Lcom/android/internal/telephony/BaseCommands;->mCallStateRegistrants:Landroid/os/RegistrantList; Lcom/android/internal/telephony/BaseCommands;->mCallWaitingInfoRegistrants:Landroid/os/RegistrantList; Lcom/android/internal/telephony/BaseCommands;->mCatCallSetUpRegistrant:Landroid/os/Registrant; @@ -2887,7 +2858,6 @@ Lcom/android/internal/telephony/GsmCdmaPhone;->notifyPreciseCallStateChanged()V Lcom/android/internal/telephony/GsmCdmaPhone;->notifyServiceStateChanged(Landroid/telephony/ServiceState;)V Lcom/android/internal/telephony/GsmCdmaPhone;->setOnEcbModeExitResponse(Landroid/os/Handler;ILjava/lang/Object;)V Lcom/android/internal/telephony/GsmCdmaPhone;->syncClirSetting()V -Lcom/android/internal/telephony/ICarrierConfigLoader;->getConfigForSubId(ILjava/lang/String;)Landroid/os/PersistableBundle; Lcom/android/internal/telephony/IccCard;->getState()Lcom/android/internal/telephony/IccCardConstants$State; Lcom/android/internal/telephony/IccCard;->registerForNetworkLocked(Landroid/os/Handler;ILjava/lang/Object;)V Lcom/android/internal/telephony/IccCard;->supplyNetworkDepersonalization(Ljava/lang/String;Landroid/os/Message;)V @@ -3093,8 +3063,6 @@ Lcom/android/internal/telephony/IPhoneSubInfo$Stub$Proxy;->(Landroid/os/IB Lcom/android/internal/telephony/IPhoneSubInfo$Stub$Proxy;->getDeviceId(Ljava/lang/String;)Ljava/lang/String; Lcom/android/internal/telephony/IPhoneSubInfo$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/telephony/IPhoneSubInfo; Lcom/android/internal/telephony/IPhoneSubInfo$Stub;->TRANSACTION_getDeviceId:I -Lcom/android/internal/telephony/IPhoneSubInfo;->getIccSerialNumber(Ljava/lang/String;)Ljava/lang/String; -Lcom/android/internal/telephony/IPhoneSubInfo;->getSubscriberId(Ljava/lang/String;)Ljava/lang/String; Lcom/android/internal/telephony/ISms$Stub;->()V Lcom/android/internal/telephony/ISms$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/telephony/ISms; Lcom/android/internal/telephony/ISub$Stub$Proxy;->(Landroid/os/IBinder;)V @@ -3108,38 +3076,9 @@ Lcom/android/internal/telephony/ITelephony$Stub;->DESCRIPTOR:Ljava/lang/String; Lcom/android/internal/telephony/ITelephony$Stub;->TRANSACTION_call:I Lcom/android/internal/telephony/ITelephony$Stub;->TRANSACTION_dial:I Lcom/android/internal/telephony/ITelephony$Stub;->TRANSACTION_getDeviceId:I -Lcom/android/internal/telephony/ITelephony;->call(Ljava/lang/String;Ljava/lang/String;)V -Lcom/android/internal/telephony/ITelephony;->dial(Ljava/lang/String;)V -Lcom/android/internal/telephony/ITelephony;->disableDataConnectivity()Z -Lcom/android/internal/telephony/ITelephony;->disableLocationUpdates()V -Lcom/android/internal/telephony/ITelephony;->enableDataConnectivity()Z -Lcom/android/internal/telephony/ITelephony;->enableLocationUpdates()V -Lcom/android/internal/telephony/ITelephony;->getActivePhoneType()I -Lcom/android/internal/telephony/ITelephony;->getCallState()I -Lcom/android/internal/telephony/ITelephony;->getDataActivity()I -Lcom/android/internal/telephony/ITelephony;->getDataEnabled(I)Z -Lcom/android/internal/telephony/ITelephony;->getDataState()I -Lcom/android/internal/telephony/ITelephony;->getNetworkType()I -Lcom/android/internal/telephony/ITelephony;->handlePinMmi(Ljava/lang/String;)Z -Lcom/android/internal/telephony/ITelephony;->handlePinMmiForSubscriber(ILjava/lang/String;)Z -Lcom/android/internal/telephony/ITelephony;->hasIccCard()Z -Lcom/android/internal/telephony/ITelephony;->iccCloseLogicalChannel(II)Z -Lcom/android/internal/telephony/ITelephony;->iccTransmitApduLogicalChannel(IIIIIIILjava/lang/String;)Ljava/lang/String; -Lcom/android/internal/telephony/ITelephony;->isRadioOnForSubscriber(ILjava/lang/String;)Z -Lcom/android/internal/telephony/ITelephony;->setRadio(Z)Z -Lcom/android/internal/telephony/ITelephony;->supplyPin(Ljava/lang/String;)Z -Lcom/android/internal/telephony/ITelephony;->toggleRadioOnOff()V -Lcom/android/internal/telephony/ITelephony;->updateServiceLocation()V Lcom/android/internal/telephony/ITelephonyRegistry$Stub$Proxy;->(Landroid/os/IBinder;)V Lcom/android/internal/telephony/ITelephonyRegistry$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/telephony/ITelephonyRegistry; -Lcom/android/internal/telephony/ITelephonyRegistry;->listen(Ljava/lang/String;Lcom/android/internal/telephony/IPhoneStateListener;IZ)V -Lcom/android/internal/telephony/ITelephonyRegistry;->notifyCallState(ILjava/lang/String;)V -Lcom/android/internal/telephony/ITelephonyRegistry;->notifyCellInfo(Ljava/util/List;)V -Lcom/android/internal/telephony/ITelephonyRegistry;->notifyDataConnectionFailed(Ljava/lang/String;)V Lcom/android/internal/telephony/IWapPushManager$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/telephony/IWapPushManager; -Lcom/android/internal/telephony/IWapPushManager;->addPackage(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IZZ)Z -Lcom/android/internal/telephony/IWapPushManager;->deletePackage(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Z -Lcom/android/internal/telephony/IWapPushManager;->updatePackage(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IZZ)Z Lcom/android/internal/telephony/MccTable$MccEntry;->mIso:Ljava/lang/String; Lcom/android/internal/telephony/MccTable;->countryCodeForMcc(I)Ljava/lang/String; Lcom/android/internal/telephony/MccTable;->defaultLanguageForMcc(I)Ljava/lang/String; @@ -3934,23 +3873,7 @@ Lcom/android/internal/widget/ActionBarOverlayLayout;->(Landroid/content/Co Lcom/android/internal/widget/ActionBarOverlayLayout;->setWindowCallback(Landroid/view/Window$Callback;)V Lcom/android/internal/widget/EditableInputConnection;->(Landroid/widget/TextView;)V Lcom/android/internal/widget/ILockSettings$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/widget/ILockSettings; -Lcom/android/internal/widget/ILockSettings;->getBoolean(Ljava/lang/String;ZI)Z -Lcom/android/internal/widget/ILockSettings;->getLong(Ljava/lang/String;JI)J -Lcom/android/internal/widget/ILockSettings;->getString(Ljava/lang/String;Ljava/lang/String;I)Ljava/lang/String; -Lcom/android/internal/widget/ILockSettings;->havePassword(I)Z -Lcom/android/internal/widget/ILockSettings;->havePattern(I)Z -Lcom/android/internal/widget/ILockSettings;->setBoolean(Ljava/lang/String;ZI)V -Lcom/android/internal/widget/ILockSettings;->setLong(Ljava/lang/String;JI)V -Lcom/android/internal/widget/ILockSettings;->setString(Ljava/lang/String;Ljava/lang/String;I)V Lcom/android/internal/widget/IRemoteViewsFactory$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/widget/IRemoteViewsFactory; -Lcom/android/internal/widget/IRemoteViewsFactory;->getCount()I -Lcom/android/internal/widget/IRemoteViewsFactory;->getItemId(I)J -Lcom/android/internal/widget/IRemoteViewsFactory;->getLoadingView()Landroid/widget/RemoteViews; -Lcom/android/internal/widget/IRemoteViewsFactory;->getViewAt(I)Landroid/widget/RemoteViews; -Lcom/android/internal/widget/IRemoteViewsFactory;->getViewTypeCount()I -Lcom/android/internal/widget/IRemoteViewsFactory;->hasStableIds()Z -Lcom/android/internal/widget/IRemoteViewsFactory;->isCreated()Z -Lcom/android/internal/widget/IRemoteViewsFactory;->onDataSetChanged()V Lcom/android/internal/widget/LinearLayoutWithDefaultTouchRecepient;->(Landroid/content/Context;)V Lcom/android/internal/widget/LinearLayoutWithDefaultTouchRecepient;->setDefaultTouchRecepient(Landroid/view/View;)V Lcom/android/internal/widget/LockPatternChecker;->checkPassword(Lcom/android/internal/widget/LockPatternUtils;Ljava/lang/String;ILcom/android/internal/widget/LockPatternChecker$OnCheckCallback;)Landroid/os/AsyncTask; diff --git a/core/java/com/android/internal/app/IAppOpsService.aidl b/core/java/com/android/internal/app/IAppOpsService.aidl index 8a90cade35a..c096961c57b 100644 --- a/core/java/com/android/internal/app/IAppOpsService.aidl +++ b/core/java/com/android/internal/app/IAppOpsService.aidl @@ -32,6 +32,7 @@ interface IAppOpsService { int noteOperation(int code, int uid, String packageName); int startOperation(IBinder token, int code, int uid, String packageName, boolean startIfModeDefault); + @UnsupportedAppUsage void finishOperation(IBinder token, int code, int uid, String packageName); void startWatchingMode(int op, String packageName, IAppOpsCallback callback); void stopWatchingMode(IAppOpsCallback callback); @@ -42,7 +43,9 @@ interface IAppOpsService { // Remaining methods are only used in Java. int checkPackage(int uid, String packageName); + @UnsupportedAppUsage List getPackagesForOps(in int[] ops); + @UnsupportedAppUsage List getOpsForPackage(int uid, String packageName, in int[] ops); void getHistoricalOps(int uid, String packageName, in List ops, long beginTimeMillis, long endTimeMillis, in RemoteCallback callback); @@ -55,7 +58,9 @@ interface IAppOpsService { void clearHistory(); List getUidOps(int uid, in int[] ops); void setUidMode(int code, int uid, int mode); + @UnsupportedAppUsage void setMode(int code, int uid, String packageName, int mode); + @UnsupportedAppUsage void resetAllModes(int reqUserId, String reqPackageName); int checkAudioOperation(int code, int usage, int uid, String packageName); void setAudioRestriction(int code, int usage, int uid, int mode, in String[] exceptionPackages); diff --git a/core/java/com/android/internal/app/IBatteryStats.aidl b/core/java/com/android/internal/app/IBatteryStats.aidl index d7514d1fe26..114d31f207b 100644 --- a/core/java/com/android/internal/app/IBatteryStats.aidl +++ b/core/java/com/android/internal/app/IBatteryStats.aidl @@ -49,11 +49,13 @@ interface IBatteryStats { void noteResetFlashlight(); // Remaining methods are only used in Java. + @UnsupportedAppUsage byte[] getStatistics(); ParcelFileDescriptor getStatisticsStream(); // Return true if we see the battery as currently charging. + @UnsupportedAppUsage boolean isCharging(); // Return the computed amount of time remaining on battery, in milliseconds. @@ -62,6 +64,7 @@ interface IBatteryStats { // Return the computed amount of time remaining to fully charge, in milliseconds. // Returns -1 if nothing could be computed. + @UnsupportedAppUsage long computeChargeTimeRemaining(); void noteEvent(int code, String name, int uid); @@ -131,6 +134,7 @@ interface IBatteryStats { void noteDeviceIdleMode(int mode, String activeReason, int activeUid); void setBatteryState(int status, int health, int plugType, int level, int temp, int volt, int chargeUAh, int chargeFullUAh); + @UnsupportedAppUsage long getAwakeTimeBattery(); long getAwakeTimePlugged(); diff --git a/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl b/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl index 9ce7ed1562c..420749e558e 100644 --- a/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl +++ b/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl @@ -51,6 +51,7 @@ interface IVoiceInteractionManagerService { * @param keyphraseId The unique identifier for the keyphrase. * @param bcp47Locale The BCP47 language tag for the keyphrase's locale. */ + @UnsupportedAppUsage SoundTrigger.KeyphraseSoundModel getKeyphraseSoundModel(int keyphraseId, in String bcp47Locale); /** * Add/Update the given keyphrase sound model. diff --git a/core/java/com/android/internal/appwidget/IAppWidgetService.aidl b/core/java/com/android/internal/appwidget/IAppWidgetService.aidl index f9bf3736422..6d1d1abd1ec 100644 --- a/core/java/com/android/internal/appwidget/IAppWidgetService.aidl +++ b/core/java/com/android/internal/appwidget/IAppWidgetService.aidl @@ -42,6 +42,7 @@ interface IAppWidgetService { void deleteAppWidgetId(String callingPackage, int appWidgetId); void deleteHost(String packageName, int hostId); void deleteAllHosts(); + @UnsupportedAppUsage RemoteViews getAppWidgetViews(String callingPackage, int appWidgetId); int[] getAppWidgetIdsForHost(String callingPackage, int hostId); IntentSender createAppWidgetConfigIntentSender(String callingPackage, int appWidgetId, @@ -63,11 +64,14 @@ interface IAppWidgetService { AppWidgetProviderInfo getAppWidgetInfo(String callingPackage, int appWidgetId); boolean hasBindAppWidgetPermission(in String packageName, int userId); void setBindAppWidgetPermission(in String packageName, int userId, in boolean permission); + @UnsupportedAppUsage boolean bindAppWidgetId(in String callingPackage, int appWidgetId, int providerProfileId, in ComponentName providerComponent, in Bundle options); + @UnsupportedAppUsage boolean bindRemoteViewsService(String callingPackage, int appWidgetId, in Intent intent, IApplicationThread caller, IBinder token, IServiceConnection connection, int flags); + @UnsupportedAppUsage int[] getAppWidgetIds(in ComponentName providerComponent); boolean isBoundWidgetPackage(String packageName, int userId); boolean requestPinAppWidget(String packageName, in ComponentName providerComponent, diff --git a/core/java/com/android/internal/os/IDropBoxManagerService.aidl b/core/java/com/android/internal/os/IDropBoxManagerService.aidl index 70844ee4ef1..5e60394e567 100644 --- a/core/java/com/android/internal/os/IDropBoxManagerService.aidl +++ b/core/java/com/android/internal/os/IDropBoxManagerService.aidl @@ -37,5 +37,6 @@ interface IDropBoxManagerService { boolean isTagEnabled(String tag); /** @see DropBoxManager#getNextEntry */ + @UnsupportedAppUsage DropBoxManager.Entry getNextEntry(String tag, long millis, String packageName); } diff --git a/core/java/com/android/internal/policy/IKeyguardService.aidl b/core/java/com/android/internal/policy/IKeyguardService.aidl index e5d5685ab3e..54f31f9199c 100644 --- a/core/java/com/android/internal/policy/IKeyguardService.aidl +++ b/core/java/com/android/internal/policy/IKeyguardService.aidl @@ -88,8 +88,10 @@ oneway interface IKeyguardService { */ void onScreenTurnedOff(); + @UnsupportedAppUsage void setKeyguardEnabled(boolean enabled); void onSystemReady(); + @UnsupportedAppUsage void doKeyguardTimeout(in Bundle options); void setSwitchingUser(boolean switching); void setCurrentUser(int userId); diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl index bfb50848df2..34376143076 100644 --- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl @@ -31,16 +31,21 @@ import com.android.internal.statusbar.NotificationVisibility; /** @hide */ interface IStatusBarService { + @UnsupportedAppUsage void expandNotificationsPanel(); + @UnsupportedAppUsage void collapsePanels(); void togglePanel(); + @UnsupportedAppUsage void disable(int what, IBinder token, String pkg); void disableForUser(int what, IBinder token, String pkg, int userId); void disable2(int what, IBinder token, String pkg); void disable2ForUser(int what, IBinder token, String pkg, int userId); int[] getDisableFlags(IBinder token, int userId); void setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription); + @UnsupportedAppUsage void setIconVisibility(String slot, boolean visible); + @UnsupportedAppUsage void removeIcon(String slot); // TODO(b/117478341): support back button change when IME is showing on a external display. void setImeWindowStatus(in IBinder token, int vis, int backDisposition, @@ -87,6 +92,7 @@ interface IStatusBarService void addTile(in ComponentName tile); void remTile(in ComponentName tile); void clickTile(in ComponentName tile); + @UnsupportedAppUsage void handleSystemKey(in int key); /** diff --git a/core/java/com/android/internal/widget/ILockSettings.aidl b/core/java/com/android/internal/widget/ILockSettings.aidl index 1c5816c1578..3be7c3e3589 100644 --- a/core/java/com/android/internal/widget/ILockSettings.aidl +++ b/core/java/com/android/internal/widget/ILockSettings.aidl @@ -30,11 +30,17 @@ import java.util.Map; /** {@hide} */ interface ILockSettings { + @UnsupportedAppUsage void setBoolean(in String key, in boolean value, in int userId); + @UnsupportedAppUsage void setLong(in String key, in long value, in int userId); + @UnsupportedAppUsage void setString(in String key, in String value, in int userId); + @UnsupportedAppUsage boolean getBoolean(in String key, in boolean defaultValue, in int userId); + @UnsupportedAppUsage long getLong(in String key, in long defaultValue, in int userId); + @UnsupportedAppUsage String getString(in String key, in String defaultValue, in int userId); void setLockCredential(in byte[] credential, int type, in byte[] savedCredential, int requestedQuality, int userId); void resetKeyStore(int userId); @@ -43,7 +49,9 @@ interface ILockSettings { VerifyCredentialResponse verifyCredential(in byte[] credential, int type, long challenge, int userId); VerifyCredentialResponse verifyTiedProfileChallenge(in byte[] credential, int type, long challenge, int userId); boolean checkVoldPassword(int userId); + @UnsupportedAppUsage boolean havePattern(int userId); + @UnsupportedAppUsage boolean havePassword(int userId); byte[] getHashFactor(in byte[] currentCredential, int userId); void setSeparateProfileChallengeEnabled(int userId, boolean enabled, in byte[] managedUserPassword); diff --git a/core/java/com/android/internal/widget/IRemoteViewsFactory.aidl b/core/java/com/android/internal/widget/IRemoteViewsFactory.aidl index 7317ecf68fe..d6efca5d36e 100644 --- a/core/java/com/android/internal/widget/IRemoteViewsFactory.aidl +++ b/core/java/com/android/internal/widget/IRemoteViewsFactory.aidl @@ -21,15 +21,23 @@ import android.widget.RemoteViews; /** {@hide} */ interface IRemoteViewsFactory { + @UnsupportedAppUsage void onDataSetChanged(); oneway void onDataSetChangedAsync(); oneway void onDestroy(in Intent intent); + @UnsupportedAppUsage int getCount(); + @UnsupportedAppUsage RemoteViews getViewAt(int position); + @UnsupportedAppUsage RemoteViews getLoadingView(); + @UnsupportedAppUsage int getViewTypeCount(); + @UnsupportedAppUsage long getItemId(int position); + @UnsupportedAppUsage boolean hasStableIds(); + @UnsupportedAppUsage boolean isCreated(); } diff --git a/location/java/com/android/internal/location/ILocationProvider.aidl b/location/java/com/android/internal/location/ILocationProvider.aidl index 71b54fb65ae..a5716304f0d 100644 --- a/location/java/com/android/internal/location/ILocationProvider.aidl +++ b/location/java/com/android/internal/location/ILocationProvider.aidl @@ -36,6 +36,8 @@ interface ILocationProvider { oneway void sendExtraCommand(String command, in Bundle extras); // --- deprecated and will be removed the future --- + @UnsupportedAppUsage int getStatus(out Bundle extras); + @UnsupportedAppUsage long getStatusUpdateTime(); } diff --git a/location/java/com/android/internal/location/ILocationProviderManager.aidl b/location/java/com/android/internal/location/ILocationProviderManager.aidl index 79166ae3a9b..85e18ba5ec4 100644 --- a/location/java/com/android/internal/location/ILocationProviderManager.aidl +++ b/location/java/com/android/internal/location/ILocationProviderManager.aidl @@ -28,9 +28,12 @@ interface ILocationProviderManager { void onSetAdditionalProviderPackages(in List packageNames); + @UnsupportedAppUsage void onSetEnabled(boolean enabled); + @UnsupportedAppUsage void onSetProperties(in ProviderProperties properties); + @UnsupportedAppUsage void onReportLocation(in Location location); } diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl index 5030f90afd3..93eea56f649 100644 --- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl +++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl @@ -182,6 +182,7 @@ interface ITelecomService { /** * @see TelecomServiceImpl#getCallState */ + @UnsupportedAppUsage int getCallState(); /** diff --git a/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl b/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl index 5cd67d977ad..8e50a8f9d7d 100644 --- a/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl +++ b/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl @@ -23,6 +23,7 @@ import android.os.PersistableBundle; */ interface ICarrierConfigLoader { + @UnsupportedAppUsage PersistableBundle getConfigForSubId(int subId, String callingPackage); void overrideConfig(int subId, in PersistableBundle overrides); diff --git a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl index abcb15ae4d5..5b509b7260b 100644 --- a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl +++ b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl @@ -60,6 +60,7 @@ interface IPhoneSubInfo { /** * Retrieves the unique sbuscriber ID, e.g., IMSI for GSM phones. */ + @UnsupportedAppUsage String getSubscriberId(String callingPackage); /** @@ -75,6 +76,7 @@ interface IPhoneSubInfo { /** * Retrieves the serial number of the ICC, if applicable. */ + @UnsupportedAppUsage String getIccSerialNumber(String callingPackage); /** diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index d1838370d02..0a8890fc3d9 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -76,6 +76,7 @@ interface ITelephony { * @param number the number to be dialed. If null, this * would display the Dialer screen with no number pre-filled. */ + @UnsupportedAppUsage void dial(String number); /** @@ -83,6 +84,7 @@ interface ITelephony { * @param callingPackage The package making the call. * @param number the number to be called. */ + @UnsupportedAppUsage void call(String callingPackage, String number); /** @@ -98,6 +100,7 @@ interface ITelephony { * @param callingPackage the name of the package making the call. * @return returns true if the radio is on. */ + @UnsupportedAppUsage boolean isRadioOnForSubscriber(int subId, String callingPackage); /** @@ -105,6 +108,7 @@ interface ITelephony { * @param pin The pin to check. * @return whether the operation was a success. */ + @UnsupportedAppUsage boolean supplyPin(String pin); /** @@ -182,6 +186,7 @@ interface ITelephony { * @param dialString the MMI command to be executed. * @return true if MMI command is executed. */ + @UnsupportedAppUsage boolean handlePinMmi(String dialString); @@ -202,11 +207,13 @@ interface ITelephony { * @param subId user preferred subId. * @return true if MMI command is executed. */ + @UnsupportedAppUsage boolean handlePinMmiForSubscriber(int subId, String dialString); /** * Toggles the radio on or off. */ + @UnsupportedAppUsage void toggleRadioOnOff(); /** @@ -218,6 +225,7 @@ interface ITelephony { /** * Set the radio to on or off */ + @UnsupportedAppUsage boolean setRadio(boolean turnOn); /** @@ -234,6 +242,7 @@ interface ITelephony { /** * Request to update location information in service state */ + @UnsupportedAppUsage void updateServiceLocation(); /** @@ -245,6 +254,7 @@ interface ITelephony { /** * Enable location update notifications. */ + @UnsupportedAppUsage void enableLocationUpdates(); /** @@ -256,6 +266,7 @@ interface ITelephony { /** * Disable location update notifications. */ + @UnsupportedAppUsage void disableLocationUpdates(); /** @@ -267,11 +278,13 @@ interface ITelephony { /** * Allow mobile data connections. */ + @UnsupportedAppUsage boolean enableDataConnectivity(); /** * Disallow mobile data connections. */ + @UnsupportedAppUsage boolean disableDataConnectivity(); /** @@ -293,6 +306,7 @@ interface ITelephony { */ List getNeighboringCellInfo(String callingPkg); + @UnsupportedAppUsage int getCallState(); /** @@ -300,7 +314,9 @@ interface ITelephony { */ int getCallStateForSlot(int slotIndex); + @UnsupportedAppUsage int getDataActivity(); + @UnsupportedAppUsage int getDataState(); /** @@ -308,6 +324,7 @@ interface ITelephony { * Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE * and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE */ + @UnsupportedAppUsage int getActivePhoneType(); /** @@ -444,6 +461,7 @@ interface ITelephony { * Returns the network type for data transmission * Legacy call, permission-free */ + @UnsupportedAppUsage int getNetworkType(); /** @@ -477,6 +495,7 @@ interface ITelephony { /** * Return true if an ICC card is present */ + @UnsupportedAppUsage boolean hasIccCard(); /** @@ -557,6 +576,7 @@ interface ITelephony { * successful iccOpenLogicalChannel. * @return true if the channel was closed successfully. */ + @UnsupportedAppUsage boolean iccCloseLogicalChannel(int subId, int channel); /** @@ -577,6 +597,7 @@ interface ITelephony { * @return The APDU response from the ICC card with the status appended at * the end. */ + @UnsupportedAppUsage String iccTransmitApduLogicalChannel(int subId, int channel, int cla, int instruction, int p1, int p2, int p3, String data); @@ -829,6 +850,7 @@ interface ITelephony { * * @return true on enabled */ + @UnsupportedAppUsage boolean getDataEnabled(int subId); /** diff --git a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl index 6de608e7b53..0610c5d106c 100644 --- a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl @@ -38,9 +38,11 @@ interface ITelephonyRegistry { IOnSubscriptionsChangedListener callback); void removeOnSubscriptionsChangedListener(String pkg, IOnSubscriptionsChangedListener callback); + @UnsupportedAppUsage void listen(String pkg, IPhoneStateListener callback, int events, boolean notifyNow); void listenForSubscriber(in int subId, String pkg, IPhoneStateListener callback, int events, boolean notifyNow); + @UnsupportedAppUsage void notifyCallState(int state, String incomingNumber); void notifyCallStateForPhoneId(in int phoneId, in int subId, int state, String incomingNumber); void notifyServiceStateForPhoneId(in int phoneId, in int subId, in ServiceState state); @@ -57,11 +59,13 @@ interface ITelephonyRegistry { void notifyDataConnectionForSubscriber(int subId, int state, boolean isDataConnectivityPossible, String apn, String apnType, in LinkProperties linkProperties, in NetworkCapabilities networkCapabilities, int networkType, boolean roaming); + @UnsupportedAppUsage void notifyDataConnectionFailed(String apnType); void notifyDataConnectionFailedForSubscriber(int subId, String apnType); void notifyCellLocation(in Bundle cellLocation); void notifyCellLocationForSubscriber(in int subId, in Bundle cellLocation); void notifyOtaspChanged(in int otaspMode); + @UnsupportedAppUsage void notifyCellInfo(in List cellInfo); void notifyPhysicalChannelConfiguration(in List configs); void notifyPhysicalChannelConfigurationForSubscriber(in int subId, diff --git a/telephony/java/com/android/internal/telephony/IWapPushManager.aidl b/telephony/java/com/android/internal/telephony/IWapPushManager.aidl index d5ecb940c8d..1c3df65336f 100644 --- a/telephony/java/com/android/internal/telephony/IWapPushManager.aidl +++ b/telephony/java/com/android/internal/telephony/IWapPushManager.aidl @@ -30,6 +30,7 @@ interface IWapPushManager { * Returns true if inserting the information is successfull. Inserting the duplicated * record in the application ID table is not allowed. Use update/delete method. */ + @UnsupportedAppUsage boolean addPackage(String x_app_id, String content_type, String package_name, String class_name, int app_type, boolean need_signature, boolean further_processing); @@ -38,6 +39,7 @@ interface IWapPushManager { * Updates receiver application that is last added. * Returns true if updating the information is successfull. */ + @UnsupportedAppUsage boolean updatePackage(String x_app_id, String content_type, String package_name, String class_name, int app_type, boolean need_signature, boolean further_processing); @@ -46,6 +48,7 @@ interface IWapPushManager { * Delites receiver application information. * Returns true if deleting is successfull. */ + @UnsupportedAppUsage boolean deletePackage(String x_app_id, String content_type, String package_name, String class_name); } -- GitLab From e35b282c0c2e71a1b2642980048381f4b1cbc104 Mon Sep 17 00:00:00 2001 From: Olivier Gaillard Date: Wed, 27 Feb 2019 17:09:40 +0000 Subject: [PATCH 051/398] Reset the condition to the initial state. For conditions without a condition, the initial state is true, not unknown. Test: atest statsd_test Change-Id: Iba27a8ea82af9b9e5e1f8ee17f091f344674d14a --- cmds/statsd/src/metrics/MetricProducer.h | 6 +++++- cmds/statsd/src/metrics/ValueMetricProducer.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmds/statsd/src/metrics/MetricProducer.h b/cmds/statsd/src/metrics/MetricProducer.h index 99cb5d4389c..046f9963b35 100644 --- a/cmds/statsd/src/metrics/MetricProducer.h +++ b/cmds/statsd/src/metrics/MetricProducer.h @@ -69,7 +69,7 @@ public: mTimeBaseNs(timeBaseNs), mCurrentBucketStartTimeNs(timeBaseNs), mCurrentBucketNum(0), - mCondition(conditionIndex >= 0 ? ConditionState::kUnknown : ConditionState::kTrue), + mCondition(initialCondition(conditionIndex)), mConditionSliced(false), mWizard(wizard), mConditionTrackerIndex(conditionIndex), @@ -82,6 +82,10 @@ public: virtual ~MetricProducer(){}; + ConditionState initialCondition(const int conditionIndex) const { + return conditionIndex >= 0 ? ConditionState::kUnknown : ConditionState::kTrue; + } + /** * Forces this metric to split into a partial bucket right now. If we're past a full bucket, we * first call the standard flushing code to flush up to the latest full bucket. Then we call diff --git a/cmds/statsd/src/metrics/ValueMetricProducer.cpp b/cmds/statsd/src/metrics/ValueMetricProducer.cpp index 9de62a2cce0..27ee57013fd 100644 --- a/cmds/statsd/src/metrics/ValueMetricProducer.cpp +++ b/cmds/statsd/src/metrics/ValueMetricProducer.cpp @@ -394,7 +394,7 @@ void ValueMetricProducer::onConditionChangedLocked(const bool condition, invalidateCurrentBucket(); // Something weird happened. If we received another event if the future, the condition might // be wrong. - mCondition = ConditionState::kUnknown; + mCondition = initialCondition(mConditionTrackerIndex); } // This part should alway be called. -- GitLab From b67766054a50c7cff7a061f947e31b0a2a204327 Mon Sep 17 00:00:00 2001 From: Garfield Tan Date: Wed, 20 Feb 2019 14:44:26 -0800 Subject: [PATCH 052/398] Report orientation change when visibility changes. AppWindowToken#getOrientation(int) consults visibility to decide if it returns requested orientation or SCREEN_ORIENTATION_UNSET. Therefore if the requested orientation is not unset, the requested orientation exposed will be changed. This gives corresponding task a chance to letterbox when the visibility of top activity changes, which covers cases where top activity changes. To make this change less risky at this moment, only call it when we're sure that display doesn't rotate for app requested orientation. Add a null check in Task#onDescednantOrientationChanged() because it now may be called when app is closing and TaskRecord has been detached from its ActivityStack. Bug: 123716525 Test: Manual tests. go/wm-smoke on default mode. atest AppWindowTokenTests Change-Id: I6f4fba9f98c134e64f1d06e8556069b5609ef925 --- .../com/android/server/wm/AppWindowToken.java | 22 +++++++++ .../core/java/com/android/server/wm/Task.java | 2 +- .../server/wm/AppWindowTokenTests.java | 47 ++++++++++++++++++- .../android/server/wm/WindowTestUtils.java | 2 + 4 files changed, 71 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java index 88c8b953a2e..ce5a047bd29 100644 --- a/services/core/java/com/android/server/wm/AppWindowToken.java +++ b/services/core/java/com/android/server/wm/AppWindowToken.java @@ -582,6 +582,8 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree } } } + // Changes in opening apps and closing apps may cause orientation change. + reportDescendantOrientationChangeIfNeeded(); return; } @@ -729,11 +731,31 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree } SurfaceControl.closeTransaction(); } + + // Visibility changes may cause orientation request change. + reportDescendantOrientationChangeIfNeeded(); } return delayed; } + private void reportDescendantOrientationChangeIfNeeded() { + // Orientation request is exposed only when we're visible. Therefore visibility change + // will change requested orientation. Notify upward the hierarchy ladder to adjust + // configuration. This is important to cases where activities with incompatible + // orientations launch, or user goes back from an activity of bi-orientation to an + // activity with specified orientation. + if (mActivityRecord.getRequestedConfigurationOrientation() == getConfiguration().orientation + || getOrientationIgnoreVisibility() == SCREEN_ORIENTATION_UNSET) { + return; + } + + final IBinder freezeToken = + mActivityRecord.mayFreezeScreenLocked(mActivityRecord.app) + ? mActivityRecord.appToken : null; + onDescendantOrientationChanged(freezeToken, mActivityRecord); + } + /** * @return The to top most child window for which {@link LayoutParams#isFullscreen()} returns * true. diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index 888d7416316..499cbaf915a 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -330,7 +330,7 @@ class Task extends WindowContainer implements ConfigurationConta // No one in higher hierarchy handles this request, let's adjust our bounds to fulfill // it if possible. // TODO: Move to TaskRecord after unification is done. - if (mTaskRecord != null) { + if (mTaskRecord != null && mTaskRecord.getParent() != null) { mTaskRecord.onConfigurationChanged(mTaskRecord.getParent().getConfiguration()); return true; } diff --git a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java index 2c575f59a02..68b40b92b9c 100644 --- a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java @@ -18,11 +18,11 @@ package com.android.server.wm; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY; -import static android.content.ActivityInfoProto.SCREEN_ORIENTATION_UNSPECIFIED; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_BEHIND; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET; +import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW; import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW; import static android.view.WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD; @@ -42,12 +42,16 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.Mockito.RETURNS_DEEP_STUBS; +import static org.mockito.Mockito.verify; import android.content.res.Configuration; import android.graphics.Point; import android.graphics.Rect; import android.platform.test.annotations.Presubmit; +import android.view.Display; import android.view.Surface; import android.view.WindowManager; @@ -55,6 +59,7 @@ import androidx.test.filters.SmallTest; import org.junit.Before; import org.junit.Test; +import org.mockito.Mockito; /** * Tests for the {@link AppWindowToken} class. @@ -331,6 +336,46 @@ public class AppWindowTokenTests extends WindowTestsBase { mWm.mDisplayFrozen = false; } + @Test + public void testReportOrientationChangeOnVisibilityChange() { + synchronized (mWm.mGlobalLock) { + mToken.setOrientation(SCREEN_ORIENTATION_LANDSCAPE); + + mDisplayContent.getDisplayRotation().setFixedToUserRotation( + DisplayRotation.FIXED_TO_USER_ROTATION_ENABLED); + + doReturn(Configuration.ORIENTATION_LANDSCAPE).when(mToken.mActivityRecord) + .getRequestedConfigurationOrientation(); + + mTask.mTaskRecord = Mockito.mock(TaskRecord.class, RETURNS_DEEP_STUBS); + mToken.commitVisibility(null, false /* visible */, TRANSIT_UNSET, + true /* performLayout */, false /* isVoiceInteraction */); + } + + verify(mTask.mTaskRecord).onConfigurationChanged(any(Configuration.class)); + } + + @Test + public void testReportOrientationChangeOnOpeningClosingAppChange() { + synchronized (mWm.mGlobalLock) { + mToken.setOrientation(SCREEN_ORIENTATION_LANDSCAPE); + + mDisplayContent.getDisplayRotation().setFixedToUserRotation( + DisplayRotation.FIXED_TO_USER_ROTATION_ENABLED); + mDisplayContent.getDisplayInfo().state = Display.STATE_ON; + mDisplayContent.prepareAppTransition(WindowManager.TRANSIT_ACTIVITY_CLOSE, + false /* alwaysKeepCurrent */, 0 /* flags */, true /* forceOverride */); + + doReturn(Configuration.ORIENTATION_LANDSCAPE).when(mToken.mActivityRecord) + .getRequestedConfigurationOrientation(); + + mTask.mTaskRecord = Mockito.mock(TaskRecord.class, RETURNS_DEEP_STUBS); + mToken.setVisibility(false, false); + } + + verify(mTask.mTaskRecord).onConfigurationChanged(any(Configuration.class)); + } + @Test public void testCreateRemoveStartingWindow() { mToken.addStartingWindow(mPackageName, diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java b/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java index da1defabeaa..0dec8ee7776 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java @@ -82,6 +82,8 @@ class WindowTestUtils { }, new ComponentName("", ""), false, dc, true /* fillsParent */); mTargetSdk = Build.VERSION_CODES.CUR_DEVELOPMENT; mSkipOnParentChanged = skipOnParentChanged; + mActivityRecord = mock(ActivityRecord.class); + mActivityRecord.app = mock(WindowProcessController.class); } int getWindowsCount() { -- GitLab From bf29986c54e18b0df3b1c00b36c529b39ba4a5e1 Mon Sep 17 00:00:00 2001 From: Jeff Chang Date: Tue, 26 Feb 2019 20:07:22 +0800 Subject: [PATCH 053/398] Signal a rerouted callback if display was set to SingleTaskInstance singleTaskInstance displays will only contain one task and any attempt to launch new task will re-route to the default display. Signal a callback for listeners to handle the case. Bug: 123642392 Test: atest ActivityManagerMultiDisplayTests#testSingleTaskInstanceDisplay Change-Id: I16b98d47a798f920a551942d761f07b1df1defc0 --- core/java/android/app/ITaskStackListener.aidl | 10 ++++++++++ core/java/android/app/TaskStackListener.java | 6 ++++++ .../shared/system/TaskStackChangeListener.java | 15 +++++++++++++++ .../shared/system/TaskStackChangeListeners.java | 16 ++++++++++++++++ .../server/wm/ActivityStackSupervisor.java | 3 +++ .../wm/TaskChangeNotificationController.java | 17 +++++++++++++++++ 6 files changed, 67 insertions(+) diff --git a/core/java/android/app/ITaskStackListener.aidl b/core/java/android/app/ITaskStackListener.aidl index 8615f00facd..8c85ad134e5 100644 --- a/core/java/android/app/ITaskStackListener.aidl +++ b/core/java/android/app/ITaskStackListener.aidl @@ -80,6 +80,16 @@ oneway interface ITaskStackListener { void onActivityLaunchOnSecondaryDisplayFailed(in ActivityManager.RunningTaskInfo taskInfo, int requestedDisplayId); + /** + * Called when an activity was requested to be launched on a secondary display but was rerouted + * to default display. + * + * @param taskInfo info about the Activity's task + * @param requestedDisplayId the id of the requested launch display + */ + void onActivityLaunchOnSecondaryDisplayRerouted(in ActivityManager.RunningTaskInfo taskInfo, + int requestedDisplayId); + /** * Called when a task is added. * diff --git a/core/java/android/app/TaskStackListener.java b/core/java/android/app/TaskStackListener.java index fcc76ac8bc4..47ad6d73743 100644 --- a/core/java/android/app/TaskStackListener.java +++ b/core/java/android/app/TaskStackListener.java @@ -84,6 +84,12 @@ public abstract class TaskStackListener extends ITaskStackListener.Stub { public void onActivityLaunchOnSecondaryDisplayFailed() throws RemoteException { } + @Override + @UnsupportedAppUsage + public void onActivityLaunchOnSecondaryDisplayRerouted(ActivityManager.RunningTaskInfo taskInfo, + int requestedDisplayId) throws RemoteException { + } + @Override public void onTaskCreated(int taskId, ComponentName componentName) throws RemoteException { } diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskStackChangeListener.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskStackChangeListener.java index 3d2f61ea027..c54a4699964 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskStackChangeListener.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskStackChangeListener.java @@ -48,6 +48,21 @@ public abstract class TaskStackChangeListener { onActivityLaunchOnSecondaryDisplayFailed(); } + /** + * @see #onActivityLaunchOnSecondaryDisplayRerouted(RunningTaskInfo taskInfo) + */ + public void onActivityLaunchOnSecondaryDisplayRerouted() { } + + /** + * Called when an activity was requested to be launched on a secondary display but was rerouted + * to default display. + * + * @param taskInfo info about the Activity's task + */ + public void onActivityLaunchOnSecondaryDisplayRerouted(RunningTaskInfo taskInfo) { + onActivityLaunchOnSecondaryDisplayRerouted(); + } + public void onTaskProfileLocked(int taskId, int userId) { } public void onTaskCreated(int taskId, ComponentName componentName) { } public void onTaskRemoved(int taskId) { } diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskStackChangeListeners.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskStackChangeListeners.java index a9ac42f5be1..7e4ab854adc 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskStackChangeListeners.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskStackChangeListeners.java @@ -140,6 +140,13 @@ public class TaskStackChangeListeners extends TaskStackListener { taskInfo).sendToTarget(); } + @Override + public void onActivityLaunchOnSecondaryDisplayRerouted(RunningTaskInfo taskInfo, + int requestedDisplayId) throws RemoteException { + mHandler.obtainMessage(H.ON_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_REROUTED, + requestedDisplayId, 0 /* unused */, taskInfo).sendToTarget(); + } + @Override public void onTaskProfileLocked(int taskId, int userId) throws RemoteException { mHandler.obtainMessage(H.ON_TASK_PROFILE_LOCKED, taskId, userId).sendToTarget(); @@ -189,6 +196,7 @@ public class TaskStackChangeListeners extends TaskStackListener { private static final int ON_TASK_REMOVED = 13; private static final int ON_TASK_MOVED_TO_FRONT = 14; private static final int ON_ACTIVITY_REQUESTED_ORIENTATION_CHANGE = 15; + private static final int ON_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_REROUTED = 16; public H(Looper looper) { @@ -270,6 +278,14 @@ public class TaskStackChangeListeners extends TaskStackListener { } break; } + case ON_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_REROUTED: { + final RunningTaskInfo info = (RunningTaskInfo) msg.obj; + for (int i = mTaskStackListeners.size() - 1; i >= 0; i--) { + mTaskStackListeners.get(i) + .onActivityLaunchOnSecondaryDisplayRerouted(info); + } + break; + } case ON_TASK_PROFILE_LOCKED: { for (int i = mTaskStackListeners.size() - 1; i >= 0; i--) { mTaskStackListeners.get(i).onTaskProfileLocked(msg.arg1, msg.arg2); diff --git a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java index df760306f12..7ae48a52c7f 100644 --- a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java @@ -2351,6 +2351,9 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { // Suppress the warning toast if the preferredDisplay was set to singleTask. // The singleTaskInstance displays will only contain one task and any attempt to // launch new task will re-route to the default display. + mService.getTaskChangeNotificationController() + .notifyActivityLaunchOnSecondaryDisplayRerouted(task.getTaskInfo(), + preferredDisplayId); return; } diff --git a/services/core/java/com/android/server/wm/TaskChangeNotificationController.java b/services/core/java/com/android/server/wm/TaskChangeNotificationController.java index 789f987e3d4..42d25833000 100644 --- a/services/core/java/com/android/server/wm/TaskChangeNotificationController.java +++ b/services/core/java/com/android/server/wm/TaskChangeNotificationController.java @@ -50,6 +50,7 @@ class TaskChangeNotificationController { private static final int NOTIFY_PINNED_STACK_ANIMATION_STARTED_LISTENERS_MSG = 16; private static final int NOTIFY_ACTIVITY_UNPINNED_LISTENERS_MSG = 17; private static final int NOTIFY_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_FAILED_MSG = 18; + private static final int NOTIFY_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_REROUTED_MSG = 19; // Delay in notifying task stack change listeners (in millis) private static final int NOTIFY_TASK_STACK_CHANGE_LISTENERS_DELAY = 100; @@ -130,6 +131,10 @@ class TaskChangeNotificationController { l.onActivityLaunchOnSecondaryDisplayFailed((RunningTaskInfo) m.obj, m.arg1); }; + private final TaskStackConsumer mNotifyActivityLaunchOnSecondaryDisplayRerouted = (l, m) -> { + l.onActivityLaunchOnSecondaryDisplayRerouted((RunningTaskInfo) m.obj, m.arg1); + }; + private final TaskStackConsumer mNotifyTaskProfileLocked = (l, m) -> { l.onTaskProfileLocked(m.arg1, m.arg2); }; @@ -202,6 +207,9 @@ class TaskChangeNotificationController { case NOTIFY_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_FAILED_MSG: forAllRemoteListeners(mNotifyActivityLaunchOnSecondaryDisplayFailed, msg); break; + case NOTIFY_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_REROUTED_MSG: + forAllRemoteListeners(mNotifyActivityLaunchOnSecondaryDisplayRerouted, msg); + break; case NOTIFY_TASK_PROFILE_LOCKED_LISTENERS_MSG: forAllRemoteListeners(mNotifyTaskProfileLocked, msg); break; @@ -355,6 +363,15 @@ class TaskChangeNotificationController { msg.sendToTarget(); } + void notifyActivityLaunchOnSecondaryDisplayRerouted(TaskInfo ti, int requestedDisplayId) { + mHandler.removeMessages(NOTIFY_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_REROUTED_MSG); + final Message msg = mHandler.obtainMessage( + NOTIFY_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_REROUTED_MSG, requestedDisplayId, + 0 /* unused */, ti); + forAllLocalListeners(mNotifyActivityLaunchOnSecondaryDisplayRerouted, msg); + msg.sendToTarget(); + } + void notifyTaskCreated(int taskId, ComponentName componentName) { final Message msg = mHandler.obtainMessage(NOTIFY_TASK_ADDED_LISTENERS_MSG, taskId, 0 /* unused */, componentName); -- GitLab From 63b728d1b77d939a918280e0c30cadb2bd48aecd Mon Sep 17 00:00:00 2001 From: Nazanin Bakhshi Date: Wed, 27 Feb 2019 10:43:00 -0800 Subject: [PATCH 054/398] create getModemEnabled function in PhoneConfigurationManager Bug: 124402911 Test: build Change-Id: I55ffeb865046296ccb7318dbb7a38680d7702f9f --- telephony/java/com/android/internal/telephony/RILConstants.java | 1 + 1 file changed, 1 insertion(+) diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java index 77b797956cf..5205973669a 100644 --- a/telephony/java/com/android/internal/telephony/RILConstants.java +++ b/telephony/java/com/android/internal/telephony/RILConstants.java @@ -470,6 +470,7 @@ public interface RILConstants { int RIL_REQUEST_START_KEEPALIVE = 144; int RIL_REQUEST_STOP_KEEPALIVE = 145; int RIL_REQUEST_ENABLE_MODEM = 146; + int RIL_REQUEST_GET_MODEM_STATUS = 147; /* The following requests are not defined in RIL.h */ int RIL_REQUEST_HAL_NON_RIL_BASE = 200; -- GitLab From b944ce5c1395b6e42fbc60fce04f119045f1c234 Mon Sep 17 00:00:00 2001 From: Gustav Sennton Date: Mon, 25 Feb 2019 18:52:43 +0000 Subject: [PATCH 055/398] Refactor smart reply inflation functionality into its own class. To prepare to move smart reply/action inflation off the UI thread we here move some functionality related to view inflation into a separate class. This refactoring should NOT change functionality in any way. Bug: 119801785 Test: none Change-Id: Idece2bab61dfa02796482d6b590124651774d655 --- .../row/NotificationContentView.java | 123 +------- .../policy/InflatedSmartReplies.java | 166 +++++++++++ .../row/NotificationContentViewTest.java | 240 --------------- .../policy/InflatedSmartRepliesTest.java | 279 ++++++++++++++++++ 4 files changed, 451 insertions(+), 357 deletions(-) create mode 100644 packages/SystemUI/src/com/android/systemui/statusbar/policy/InflatedSmartReplies.java create mode 100644 packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/InflatedSmartRepliesTest.java diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java index 1dc48d4b18b..dae14debd68 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java @@ -19,7 +19,6 @@ package com.android.systemui.statusbar.notification.row; import android.annotation.Nullable; import android.app.Notification; import android.app.PendingIntent; -import android.app.RemoteInput; import android.content.Context; import android.graphics.Rect; import android.os.Build; @@ -28,7 +27,6 @@ import android.util.ArrayMap; import android.util.ArraySet; import android.util.AttributeSet; import android.util.Log; -import android.util.Pair; import android.view.MotionEvent; import android.view.NotificationHeaderView; import android.view.View; @@ -39,7 +37,6 @@ import android.widget.ImageView; import android.widget.LinearLayout; import com.android.internal.annotations.VisibleForTesting; -import com.android.internal.util.ArrayUtils; import com.android.internal.util.ContrastColorUtil; import com.android.systemui.Dependency; import com.android.systemui.R; @@ -52,13 +49,14 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.wrapper.NotificationCustomViewWrapper; import com.android.systemui.statusbar.notification.row.wrapper.NotificationViewWrapper; import com.android.systemui.statusbar.phone.NotificationGroupManager; +import com.android.systemui.statusbar.policy.InflatedSmartReplies; +import com.android.systemui.statusbar.policy.InflatedSmartReplies.SmartRepliesAndActions; import com.android.systemui.statusbar.policy.RemoteInputView; import com.android.systemui.statusbar.policy.SmartReplyConstants; import com.android.systemui.statusbar.policy.SmartReplyView; import java.io.FileDescriptor; import java.io.PrintWriter; -import java.util.List; /** * A frame layout containing the actual payload of the notification, including the contracted, @@ -1319,7 +1317,7 @@ public class NotificationContentView extends FrameLayout { } SmartRepliesAndActions smartRepliesAndActions = - chooseSmartRepliesAndActions(mSmartReplyConstants, entry); + InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, entry); if (DEBUG) { Log.d(TAG, String.format("Adding suggestions for %s, %d actions, and %d replies.", entry.notification.getKey(), @@ -1328,86 +1326,10 @@ public class NotificationContentView extends FrameLayout { smartRepliesAndActions.smartReplies == null ? 0 : smartRepliesAndActions.smartReplies.choices.length)); } - - applyRemoteInput(entry, smartRepliesAndActions.hasFreeformRemoteInput); + applyRemoteInput(entry, InflatedSmartReplies.hasFreeformRemoteInput(entry)); applySmartReplyView(smartRepliesAndActions, entry); } - /** - * Chose what smart replies and smart actions to display. App generated suggestions take - * precedence. So if the app provides any smart replies, we don't show any - * replies or actions generated by the NotificationAssistantService (NAS), and if the app - * provides any smart actions we also don't show any NAS-generated replies or actions. - */ - @VisibleForTesting - static SmartRepliesAndActions chooseSmartRepliesAndActions( - SmartReplyConstants smartReplyConstants, - final NotificationEntry entry) { - Notification notification = entry.notification.getNotification(); - Pair remoteInputActionPair = - notification.findRemoteInputActionPair(false /* freeform */); - Pair freeformRemoteInputActionPair = - notification.findRemoteInputActionPair(true /* freeform */); - - if (!smartReplyConstants.isEnabled()) { - if (DEBUG) { - Log.d(TAG, "Smart suggestions not enabled, not adding suggestions for " - + entry.notification.getKey()); - } - return new SmartRepliesAndActions(null, null, freeformRemoteInputActionPair != null); - } - // Only use smart replies from the app if they target P or above. We have this check because - // the smart reply API has been used for other things (Wearables) in the past. The API to - // add smart actions is new in Q so it doesn't require a target-sdk check. - boolean enableAppGeneratedSmartReplies = (!smartReplyConstants.requiresTargetingP() - || entry.targetSdk >= Build.VERSION_CODES.P); - - boolean appGeneratedSmartRepliesExist = - enableAppGeneratedSmartReplies - && remoteInputActionPair != null - && !ArrayUtils.isEmpty(remoteInputActionPair.first.getChoices()) - && remoteInputActionPair.second.actionIntent != null; - - List appGeneratedSmartActions = notification.getContextualActions(); - boolean appGeneratedSmartActionsExist = !appGeneratedSmartActions.isEmpty(); - - SmartReplyView.SmartReplies smartReplies = null; - SmartReplyView.SmartActions smartActions = null; - if (appGeneratedSmartRepliesExist) { - smartReplies = new SmartReplyView.SmartReplies( - remoteInputActionPair.first.getChoices(), - remoteInputActionPair.first, - remoteInputActionPair.second.actionIntent, - false /* fromAssistant */); - } - if (appGeneratedSmartActionsExist) { - smartActions = new SmartReplyView.SmartActions(appGeneratedSmartActions, - false /* fromAssistant */); - } - // Apps didn't provide any smart replies / actions, use those from NAS (if any). - if (!appGeneratedSmartRepliesExist && !appGeneratedSmartActionsExist) { - boolean useGeneratedReplies = !ArrayUtils.isEmpty(entry.systemGeneratedSmartReplies) - && freeformRemoteInputActionPair != null - && freeformRemoteInputActionPair.second.getAllowGeneratedReplies() - && freeformRemoteInputActionPair.second.actionIntent != null; - if (useGeneratedReplies) { - smartReplies = new SmartReplyView.SmartReplies( - entry.systemGeneratedSmartReplies, - freeformRemoteInputActionPair.first, - freeformRemoteInputActionPair.second.actionIntent, - true /* fromAssistant */); - } - boolean useSmartActions = !ArrayUtils.isEmpty(entry.systemGeneratedSmartActions) - && notification.getAllowSystemGeneratedContextualActions(); - if (useSmartActions) { - smartActions = new SmartReplyView.SmartActions( - entry.systemGeneratedSmartActions, true /* fromAssistant */); - } - } - return new SmartRepliesAndActions( - smartReplies, smartActions, freeformRemoteInputActionPair != null); - } - private void applyRemoteInput(NotificationEntry entry, boolean hasFreeformRemoteInput) { View bigContentView = mExpandedChild; if (bigContentView != null) { @@ -1546,26 +1468,11 @@ public class NotificationContentView extends FrameLayout { return null; } LinearLayout smartReplyContainer = (LinearLayout) smartReplyContainerCandidate; - // If there are no smart replies and no smart actions - early out. - if (smartRepliesAndActions.smartReplies == null - && smartRepliesAndActions.smartActions == null) { - smartReplyContainer.setVisibility(View.GONE); - return null; - } - // If we are showing the spinner we don't want to add the buttons. - boolean showingSpinner = entry.notification.getNotification() - .extras.getBoolean(Notification.EXTRA_SHOW_REMOTE_INPUT_SPINNER, false); - if (showingSpinner) { - smartReplyContainer.setVisibility(View.GONE); - return null; - } - // If we are keeping the notification around while sending we don't want to add the buttons. - boolean hideSmartReplies = entry.notification.getNotification() - .extras.getBoolean(Notification.EXTRA_HIDE_SMART_REPLIES, false); - if (hideSmartReplies) { + if (!InflatedSmartReplies.shouldShowSmartReplyView(entry, smartRepliesAndActions)) { smartReplyContainer.setVisibility(View.GONE); return null; } + SmartReplyView smartReplyView = null; if (smartReplyContainer.getChildCount() == 0) { smartReplyView = SmartReplyView.inflate(mContext, smartReplyContainer); @@ -2005,22 +1912,4 @@ public class NotificationContentView extends FrameLayout { } pw.println(); } - - @VisibleForTesting - static class SmartRepliesAndActions { - @Nullable - public final SmartReplyView.SmartReplies smartReplies; - @Nullable - public final SmartReplyView.SmartActions smartActions; - public final boolean hasFreeformRemoteInput; - - SmartRepliesAndActions( - @Nullable SmartReplyView.SmartReplies smartReplies, - @Nullable SmartReplyView.SmartActions smartActions, - boolean hasFreeformRemoteInput) { - this.smartReplies = smartReplies; - this.smartActions = smartActions; - this.hasFreeformRemoteInput = hasFreeformRemoteInput; - } - } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/InflatedSmartReplies.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/InflatedSmartReplies.java new file mode 100644 index 00000000000..754bfb2b30a --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/InflatedSmartReplies.java @@ -0,0 +1,166 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.statusbar.policy; + +import android.annotation.NonNull; +import android.annotation.Nullable; +import android.app.Notification; +import android.app.RemoteInput; +import android.os.Build; +import android.util.Log; +import android.util.Pair; + +import com.android.internal.util.ArrayUtils; +import com.android.systemui.statusbar.notification.collection.NotificationEntry; + +import java.util.List; + +/** + * Holder for inflated smart replies and actions. These objects should be inflated on a background + * thread, to later be accessed and modified on the (performance critical) UI thread. + */ +public class InflatedSmartReplies { + private static final String TAG = "InflatedSmartReplies"; + private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); + + private InflatedSmartReplies() { } + + /** + * Returns whether we should show the smart reply view and its smart suggestions. + */ + public static boolean shouldShowSmartReplyView( + NotificationEntry entry, + SmartRepliesAndActions smartRepliesAndActions) { + if (smartRepliesAndActions.smartReplies == null + && smartRepliesAndActions.smartActions == null) { + // There are no smart replies and no smart actions. + return false; + } + // If we are showing the spinner we don't want to add the buttons. + boolean showingSpinner = entry.notification.getNotification() + .extras.getBoolean(Notification.EXTRA_SHOW_REMOTE_INPUT_SPINNER, false); + if (showingSpinner) { + return false; + } + // If we are keeping the notification around while sending we don't want to add the buttons. + boolean hideSmartReplies = entry.notification.getNotification() + .extras.getBoolean(Notification.EXTRA_HIDE_SMART_REPLIES, false); + if (hideSmartReplies) { + return false; + } + return true; + } + + /** + * Chose what smart replies and smart actions to display. App generated suggestions take + * precedence. So if the app provides any smart replies, we don't show any + * replies or actions generated by the NotificationAssistantService (NAS), and if the app + * provides any smart actions we also don't show any NAS-generated replies or actions. + */ + @NonNull + public static SmartRepliesAndActions chooseSmartRepliesAndActions( + SmartReplyConstants smartReplyConstants, + final NotificationEntry entry) { + Notification notification = entry.notification.getNotification(); + Pair remoteInputActionPair = + notification.findRemoteInputActionPair(false /* freeform */); + Pair freeformRemoteInputActionPair = + notification.findRemoteInputActionPair(true /* freeform */); + + if (!smartReplyConstants.isEnabled()) { + if (DEBUG) { + Log.d(TAG, "Smart suggestions not enabled, not adding suggestions for " + + entry.notification.getKey()); + } + return new SmartRepliesAndActions(null, null); + } + // Only use smart replies from the app if they target P or above. We have this check because + // the smart reply API has been used for other things (Wearables) in the past. The API to + // add smart actions is new in Q so it doesn't require a target-sdk check. + boolean enableAppGeneratedSmartReplies = (!smartReplyConstants.requiresTargetingP() + || entry.targetSdk >= Build.VERSION_CODES.P); + + boolean appGeneratedSmartRepliesExist = + enableAppGeneratedSmartReplies + && remoteInputActionPair != null + && !ArrayUtils.isEmpty(remoteInputActionPair.first.getChoices()) + && remoteInputActionPair.second.actionIntent != null; + + List appGeneratedSmartActions = notification.getContextualActions(); + boolean appGeneratedSmartActionsExist = !appGeneratedSmartActions.isEmpty(); + + SmartReplyView.SmartReplies smartReplies = null; + SmartReplyView.SmartActions smartActions = null; + if (appGeneratedSmartRepliesExist) { + smartReplies = new SmartReplyView.SmartReplies( + remoteInputActionPair.first.getChoices(), + remoteInputActionPair.first, + remoteInputActionPair.second.actionIntent, + false /* fromAssistant */); + } + if (appGeneratedSmartActionsExist) { + smartActions = new SmartReplyView.SmartActions(appGeneratedSmartActions, + false /* fromAssistant */); + } + // Apps didn't provide any smart replies / actions, use those from NAS (if any). + if (!appGeneratedSmartRepliesExist && !appGeneratedSmartActionsExist) { + boolean useGeneratedReplies = !ArrayUtils.isEmpty(entry.systemGeneratedSmartReplies) + && freeformRemoteInputActionPair != null + && freeformRemoteInputActionPair.second.getAllowGeneratedReplies() + && freeformRemoteInputActionPair.second.actionIntent != null; + if (useGeneratedReplies) { + smartReplies = new SmartReplyView.SmartReplies( + entry.systemGeneratedSmartReplies, + freeformRemoteInputActionPair.first, + freeformRemoteInputActionPair.second.actionIntent, + true /* fromAssistant */); + } + boolean useSmartActions = !ArrayUtils.isEmpty(entry.systemGeneratedSmartActions) + && notification.getAllowSystemGeneratedContextualActions(); + if (useSmartActions) { + smartActions = new SmartReplyView.SmartActions( + entry.systemGeneratedSmartActions, true /* fromAssistant */); + } + } + return new SmartRepliesAndActions(smartReplies, smartActions); + } + + /** + * Returns whether the {@link Notification} represented by entry has a free-form remote input. + * Such an input can be used e.g. to implement smart reply buttons - by passing the replies + * through the remote input. + */ + public static boolean hasFreeformRemoteInput(NotificationEntry entry) { + Notification notification = entry.notification.getNotification(); + return null != notification.findRemoteInputActionPair(true /* freeform */); + } + + /** + * A storage for smart replies and smart action. + */ + public static class SmartRepliesAndActions { + @Nullable public final SmartReplyView.SmartReplies smartReplies; + @Nullable public final SmartReplyView.SmartActions smartActions; + + SmartRepliesAndActions( + @Nullable SmartReplyView.SmartReplies smartReplies, + @Nullable SmartReplyView.SmartActions smartActions) { + this.smartReplies = smartReplies; + this.smartActions = smartActions; + } + } +} diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java index c80396d8292..d756b097034 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java @@ -16,8 +16,6 @@ package com.android.systemui.statusbar.notification.row; -import static com.google.common.truth.Truth.assertThat; - import static org.junit.Assert.assertFalse; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyFloat; @@ -31,62 +29,31 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.app.AppOpsManager; -import android.app.Notification; -import android.app.PendingIntent; -import android.app.RemoteInput; -import android.content.Intent; import android.graphics.drawable.Icon; -import android.service.notification.StatusBarNotification; import android.support.test.annotation.UiThreadTest; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; import android.util.ArraySet; -import android.util.Pair; import android.view.NotificationHeaderView; import android.view.View; -import com.android.systemui.R; import com.android.systemui.SysuiTestCase; -import com.android.systemui.statusbar.notification.collection.NotificationEntry; -import com.android.systemui.statusbar.policy.SmartReplyConstants; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -import java.util.ArrayList; -import java.util.List; @SmallTest @RunWith(AndroidJUnit4.class) public class NotificationContentViewTest extends SysuiTestCase { - private static final String TEST_ACTION = "com.android.SMART_REPLY_VIEW_ACTION"; - NotificationContentView mView; - @Mock - SmartReplyConstants mSmartReplyConstants; - @Mock - StatusBarNotification mStatusBarNotification; - @Mock - Notification mNotification; - NotificationEntry mEntry; - @Mock - RemoteInput mRemoteInput; - @Mock - RemoteInput mFreeFormRemoteInput; - private Icon mActionIcon; - @Before @UiThreadTest public void setup() { - MockitoAnnotations.initMocks(this); - mView = new NotificationContentView(mContext, null); ExpandableNotificationRow row = new ExpandableNotificationRow(mContext, null); ExpandableNotificationRow mockRow = spy(row); @@ -103,13 +70,6 @@ public class NotificationContentViewTest extends SysuiTestCase { mView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); mView.layout(0, 0, mView.getMeasuredWidth(), mView.getMeasuredHeight()); - - // Smart replies and actions - when(mNotification.getAllowSystemGeneratedContextualActions()).thenReturn(true); - when(mStatusBarNotification.getNotification()).thenReturn(mNotification); - mEntry = new NotificationEntry(mStatusBarNotification); - when(mSmartReplyConstants.isEnabled()).thenReturn(true); - mActionIcon = Icon.createWithResource(mContext, R.drawable.ic_person); } private View createViewWithHeight(int height) { @@ -158,204 +118,4 @@ public class NotificationContentViewTest extends SysuiTestCase { verify(mockAmbient, never()).showAppOpsIcons(ops); verify(mockHeadsUp, times(1)).showAppOpsIcons(any()); } - - private void setupAppGeneratedReplies(CharSequence[] smartReplies) { - setupAppGeneratedReplies(smartReplies, true /* allowSystemGeneratedReplies */); - } - - private void setupAppGeneratedReplies( - CharSequence[] smartReplies, boolean allowSystemGeneratedReplies) { - PendingIntent pendingIntent = - PendingIntent.getBroadcast(mContext, 0, new Intent(TEST_ACTION), 0); - Notification.Action action = - new Notification.Action.Builder(null, "Test Action", pendingIntent).build(); - when(mRemoteInput.getChoices()).thenReturn(smartReplies); - Pair remoteInputActionPair = - Pair.create(mRemoteInput, action); - when(mNotification.findRemoteInputActionPair(false)).thenReturn(remoteInputActionPair); - - Notification.Action freeFormRemoteInputAction = - createActionBuilder("Freeform Test Action") - .setAllowGeneratedReplies(allowSystemGeneratedReplies) - .build(); - Pair freeFormRemoteInputActionPair = - Pair.create(mFreeFormRemoteInput, freeFormRemoteInputAction); - when(mNotification.findRemoteInputActionPair(true)).thenReturn( - freeFormRemoteInputActionPair); - - when(mSmartReplyConstants.requiresTargetingP()).thenReturn(false); - } - - private void setupAppGeneratedSuggestions( - CharSequence[] smartReplies, List smartActions) { - setupAppGeneratedReplies(smartReplies); - when(mNotification.getContextualActions()).thenReturn(smartActions); - } - - @Test - public void chooseSmartRepliesAndActions_smartRepliesOff_noAppGeneratedSmartSuggestions() { - CharSequence[] smartReplies = new String[] {"Reply1", "Reply2"}; - List smartActions = - createActions(new String[] {"Test Action 1", "Test Action 2"}); - setupAppGeneratedSuggestions(smartReplies, smartActions); - when(mSmartReplyConstants.isEnabled()).thenReturn(false); - - NotificationContentView.SmartRepliesAndActions repliesAndActions = - NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); - - assertThat(repliesAndActions.smartReplies).isNull(); - assertThat(repliesAndActions.smartActions).isNull(); - } - - @Test - public void chooseSmartRepliesAndActions_smartRepliesOff_noSystemGeneratedSmartSuggestions() { - mEntry.systemGeneratedSmartReplies = - new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; - mEntry.systemGeneratedSmartActions = - createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"}); - when(mSmartReplyConstants.isEnabled()).thenReturn(false); - - NotificationContentView.SmartRepliesAndActions repliesAndActions = - NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); - - assertThat(repliesAndActions.smartReplies).isNull(); - assertThat(repliesAndActions.smartActions).isNull(); - } - - @Test - public void chooseSmartRepliesAndActions_appGeneratedSmartReplies() { - CharSequence[] smartReplies = new String[] {"Reply1", "Reply2"}; - setupAppGeneratedReplies(smartReplies); - - NotificationContentView.SmartRepliesAndActions repliesAndActions = - NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); - - assertThat(repliesAndActions.smartReplies.choices).isEqualTo(smartReplies); - assertThat(repliesAndActions.smartReplies.fromAssistant).isFalse(); - assertThat(repliesAndActions.smartActions).isNull(); - } - - @Test - public void chooseSmartRepliesAndActions_appGeneratedSmartRepliesAndActions() { - CharSequence[] smartReplies = new String[] {"Reply1", "Reply2"}; - List smartActions = - createActions(new String[] {"Test Action 1", "Test Action 2"}); - setupAppGeneratedSuggestions(smartReplies, smartActions); - - NotificationContentView.SmartRepliesAndActions repliesAndActions = - NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); - - assertThat(repliesAndActions.smartReplies.choices).isEqualTo(smartReplies); - assertThat(repliesAndActions.smartReplies.fromAssistant).isFalse(); - assertThat(repliesAndActions.smartActions.actions).isEqualTo(smartActions); - assertThat(repliesAndActions.smartActions.fromAssistant).isFalse(); - } - - @Test - public void chooseSmartRepliesAndActions_sysGeneratedSmartReplies() { - // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart - // replies. - setupAppGeneratedReplies(null /* smartReplies */); - - mEntry.systemGeneratedSmartReplies = - new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; - NotificationContentView.SmartRepliesAndActions repliesAndActions = - NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); - - assertThat(repliesAndActions.smartReplies.choices).isEqualTo( - mEntry.systemGeneratedSmartReplies); - assertThat(repliesAndActions.smartReplies.fromAssistant).isTrue(); - assertThat(repliesAndActions.smartActions).isNull(); - } - - @Test - public void chooseSmartRepliesAndActions_noSysGeneratedSmartRepliesIfNotAllowed() { - // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart - // replies. - setupAppGeneratedReplies(null /* smartReplies */, false /* allowSystemGeneratedReplies */); - - mEntry.systemGeneratedSmartReplies = - new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; - NotificationContentView.SmartRepliesAndActions repliesAndActions = - NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); - - assertThat(repliesAndActions.smartReplies).isNull(); - assertThat(repliesAndActions.smartActions).isNull(); - } - - @Test - public void chooseSmartRepliesAndActions_sysGeneratedSmartActions() { - // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart - // actions. - setupAppGeneratedReplies(null /* smartReplies */); - - mEntry.systemGeneratedSmartActions = - createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"}); - NotificationContentView.SmartRepliesAndActions repliesAndActions = - NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); - - assertThat(repliesAndActions.smartReplies).isNull(); - assertThat(repliesAndActions.smartActions.actions) - .isEqualTo(mEntry.systemGeneratedSmartActions); - assertThat(repliesAndActions.smartActions.fromAssistant).isTrue(); - } - - @Test - public void chooseSmartRepliesAndActions_appGenPreferredOverSysGen() { - CharSequence[] appGenSmartReplies = new String[] {"Reply1", "Reply2"}; - // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart - // replies. - List appGenSmartActions = - createActions(new String[] {"Test Action 1", "Test Action 2"}); - setupAppGeneratedSuggestions(appGenSmartReplies, appGenSmartActions); - - mEntry.systemGeneratedSmartReplies = - new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; - mEntry.systemGeneratedSmartActions = - createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"}); - - NotificationContentView.SmartRepliesAndActions repliesAndActions = - NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); - - assertThat(repliesAndActions.smartReplies.choices).isEqualTo(appGenSmartReplies); - assertThat(repliesAndActions.smartReplies.fromAssistant).isFalse(); - assertThat(repliesAndActions.smartActions.actions).isEqualTo(appGenSmartActions); - assertThat(repliesAndActions.smartActions.fromAssistant).isFalse(); - } - - @Test - public void chooseSmartRepliesAndActions_disallowSysGenSmartActions() { - // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart - // actions. - setupAppGeneratedReplies(null /* smartReplies */, false /* allowSystemGeneratedReplies */); - when(mNotification.getAllowSystemGeneratedContextualActions()).thenReturn(false); - mEntry.systemGeneratedSmartReplies = - new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; - mEntry.systemGeneratedSmartActions = - createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"}); - - NotificationContentView.SmartRepliesAndActions repliesAndActions = - NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); - - assertThat(repliesAndActions.smartActions).isNull(); - assertThat(repliesAndActions.smartReplies).isNull(); - } - - private Notification.Action.Builder createActionBuilder(String actionTitle) { - PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, 0, - new Intent(TEST_ACTION), 0); - return new Notification.Action.Builder(mActionIcon, actionTitle, pendingIntent); - } - - private Notification.Action createAction(String actionTitle) { - return createActionBuilder(actionTitle).build(); - } - - private List createActions(String[] actionTitles) { - List actions = new ArrayList<>(); - for (String title : actionTitles) { - actions.add(createAction(title)); - } - return actions; - } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/InflatedSmartRepliesTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/InflatedSmartRepliesTest.java new file mode 100644 index 00000000000..3382a906d05 --- /dev/null +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/InflatedSmartRepliesTest.java @@ -0,0 +1,279 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.statusbar.policy; + +import static com.google.common.truth.Truth.assertThat; + +import static org.mockito.Mockito.when; + +import android.app.Notification; +import android.app.PendingIntent; +import android.app.RemoteInput; +import android.content.Intent; +import android.graphics.drawable.Icon; +import android.service.notification.StatusBarNotification; +import android.support.test.annotation.UiThreadTest; +import android.support.test.filters.SmallTest; +import android.support.test.runner.AndroidJUnit4; +import android.util.Pair; + +import com.android.systemui.R; +import com.android.systemui.SysuiTestCase; +import com.android.systemui.statusbar.notification.collection.NotificationEntry; +import com.android.systemui.statusbar.policy.InflatedSmartReplies.SmartRepliesAndActions; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +import java.util.ArrayList; +import java.util.List; + +@SmallTest +@RunWith(AndroidJUnit4.class) +public class InflatedSmartRepliesTest extends SysuiTestCase { + + private static final String TEST_ACTION = "com.android.SMART_REPLY_VIEW_ACTION"; + + @Mock + SmartReplyConstants mSmartReplyConstants; + @Mock + StatusBarNotification mStatusBarNotification; + @Mock + Notification mNotification; + NotificationEntry mEntry; + @Mock + RemoteInput mRemoteInput; + @Mock + RemoteInput mFreeFormRemoteInput; + + private Icon mActionIcon; + + @Before + @UiThreadTest + public void setUp() { + MockitoAnnotations.initMocks(this); + + when(mNotification.getAllowSystemGeneratedContextualActions()).thenReturn(true); + when(mStatusBarNotification.getNotification()).thenReturn(mNotification); + mEntry = new NotificationEntry(mStatusBarNotification); + when(mSmartReplyConstants.isEnabled()).thenReturn(true); + mActionIcon = Icon.createWithResource(mContext, R.drawable.ic_person); + } + + @Test + public void chooseSmartRepliesAndActions_smartRepliesOff_noAppGeneratedSmartSuggestions() { + CharSequence[] smartReplies = new String[] {"Reply1", "Reply2"}; + List smartActions = + createActions(new String[] {"Test Action 1", "Test Action 2"}); + setupAppGeneratedSuggestions(smartReplies, smartActions); + when(mSmartReplyConstants.isEnabled()).thenReturn(false); + + SmartRepliesAndActions repliesAndActions = + InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); + + assertThat(repliesAndActions.smartReplies).isNull(); + assertThat(repliesAndActions.smartActions).isNull(); + } + + @Test + public void chooseSmartRepliesAndActions_smartRepliesOff_noSystemGeneratedSmartSuggestions() { + mEntry.systemGeneratedSmartReplies = + new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; + mEntry.systemGeneratedSmartActions = + createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"}); + when(mSmartReplyConstants.isEnabled()).thenReturn(false); + + SmartRepliesAndActions repliesAndActions = + InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); + + assertThat(repliesAndActions.smartReplies).isNull(); + assertThat(repliesAndActions.smartActions).isNull(); + } + + @Test + public void chooseSmartRepliesAndActions_appGeneratedSmartReplies() { + CharSequence[] smartReplies = new String[] {"Reply1", "Reply2"}; + setupAppGeneratedReplies(smartReplies); + + SmartRepliesAndActions repliesAndActions = + InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); + + assertThat(repliesAndActions.smartReplies.choices).isEqualTo(smartReplies); + assertThat(repliesAndActions.smartReplies.fromAssistant).isFalse(); + assertThat(repliesAndActions.smartActions).isNull(); + } + + @Test + public void chooseSmartRepliesAndActions_appGeneratedSmartRepliesAndActions() { + CharSequence[] smartReplies = new String[] {"Reply1", "Reply2"}; + List smartActions = + createActions(new String[] {"Test Action 1", "Test Action 2"}); + setupAppGeneratedSuggestions(smartReplies, smartActions); + + SmartRepliesAndActions repliesAndActions = + InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); + + assertThat(repliesAndActions.smartReplies.choices).isEqualTo(smartReplies); + assertThat(repliesAndActions.smartReplies.fromAssistant).isFalse(); + assertThat(repliesAndActions.smartActions.actions).isEqualTo(smartActions); + assertThat(repliesAndActions.smartActions.fromAssistant).isFalse(); + } + + @Test + public void chooseSmartRepliesAndActions_sysGeneratedSmartReplies() { + // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart + // replies. + setupAppGeneratedReplies(null /* smartReplies */); + + mEntry.systemGeneratedSmartReplies = + new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; + SmartRepliesAndActions repliesAndActions = + InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); + + assertThat(repliesAndActions.smartReplies.choices).isEqualTo( + mEntry.systemGeneratedSmartReplies); + assertThat(repliesAndActions.smartReplies.fromAssistant).isTrue(); + assertThat(repliesAndActions.smartActions).isNull(); + } + + @Test + public void chooseSmartRepliesAndActions_noSysGeneratedSmartRepliesIfNotAllowed() { + // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart + // replies. + setupAppGeneratedReplies(null /* smartReplies */, false /* allowSystemGeneratedReplies */); + + mEntry.systemGeneratedSmartReplies = + new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; + SmartRepliesAndActions repliesAndActions = + InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); + + assertThat(repliesAndActions.smartReplies).isNull(); + assertThat(repliesAndActions.smartActions).isNull(); + } + + @Test + public void chooseSmartRepliesAndActions_sysGeneratedSmartActions() { + // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart + // actions. + setupAppGeneratedReplies(null /* smartReplies */); + + mEntry.systemGeneratedSmartActions = + createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"}); + SmartRepliesAndActions repliesAndActions = + InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); + + assertThat(repliesAndActions.smartReplies).isNull(); + assertThat(repliesAndActions.smartActions.actions) + .isEqualTo(mEntry.systemGeneratedSmartActions); + assertThat(repliesAndActions.smartActions.fromAssistant).isTrue(); + } + + @Test + public void chooseSmartRepliesAndActions_appGenPreferredOverSysGen() { + CharSequence[] appGenSmartReplies = new String[] {"Reply1", "Reply2"}; + // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart + // replies. + List appGenSmartActions = + createActions(new String[] {"Test Action 1", "Test Action 2"}); + setupAppGeneratedSuggestions(appGenSmartReplies, appGenSmartActions); + + mEntry.systemGeneratedSmartReplies = + new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; + mEntry.systemGeneratedSmartActions = + createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"}); + + SmartRepliesAndActions repliesAndActions = + InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); + + assertThat(repliesAndActions.smartReplies.choices).isEqualTo(appGenSmartReplies); + assertThat(repliesAndActions.smartReplies.fromAssistant).isFalse(); + assertThat(repliesAndActions.smartActions.actions).isEqualTo(appGenSmartActions); + assertThat(repliesAndActions.smartActions.fromAssistant).isFalse(); + } + + @Test + public void chooseSmartRepliesAndActions_disallowSysGenSmartActions() { + // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart + // actions. + setupAppGeneratedReplies(null /* smartReplies */, false /* allowSystemGeneratedReplies */); + when(mNotification.getAllowSystemGeneratedContextualActions()).thenReturn(false); + mEntry.systemGeneratedSmartReplies = + new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"}; + mEntry.systemGeneratedSmartActions = + createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"}); + + SmartRepliesAndActions repliesAndActions = + InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry); + + assertThat(repliesAndActions.smartActions).isNull(); + assertThat(repliesAndActions.smartReplies).isNull(); + } + + private void setupAppGeneratedReplies(CharSequence[] smartReplies) { + setupAppGeneratedReplies(smartReplies, true /* allowSystemGeneratedReplies */); + } + + private void setupAppGeneratedReplies( + CharSequence[] smartReplies, boolean allowSystemGeneratedReplies) { + PendingIntent pendingIntent = + PendingIntent.getBroadcast(mContext, 0, new Intent(TEST_ACTION), 0); + Notification.Action action = + new Notification.Action.Builder(null, "Test Action", pendingIntent).build(); + when(mRemoteInput.getChoices()).thenReturn(smartReplies); + Pair remoteInputActionPair = + Pair.create(mRemoteInput, action); + when(mNotification.findRemoteInputActionPair(false)).thenReturn(remoteInputActionPair); + + Notification.Action freeFormRemoteInputAction = + createActionBuilder("Freeform Test Action") + .setAllowGeneratedReplies(allowSystemGeneratedReplies) + .build(); + Pair freeFormRemoteInputActionPair = + Pair.create(mFreeFormRemoteInput, freeFormRemoteInputAction); + when(mNotification.findRemoteInputActionPair(true)).thenReturn( + freeFormRemoteInputActionPair); + + when(mSmartReplyConstants.requiresTargetingP()).thenReturn(false); + } + + private void setupAppGeneratedSuggestions( + CharSequence[] smartReplies, List smartActions) { + setupAppGeneratedReplies(smartReplies); + when(mNotification.getContextualActions()).thenReturn(smartActions); + } + + private Notification.Action.Builder createActionBuilder(String actionTitle) { + PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, 0, + new Intent(TEST_ACTION), 0); + return new Notification.Action.Builder(mActionIcon, actionTitle, pendingIntent); + } + + private Notification.Action createAction(String actionTitle) { + return createActionBuilder(actionTitle).build(); + } + + private List createActions(String[] actionTitles) { + List actions = new ArrayList<>(); + for (String title : actionTitles) { + actions.add(createAction(title)); + } + return actions; + } +} -- GitLab From 5602fa6bf5eeec4a647b7d5a119762689270be52 Mon Sep 17 00:00:00 2001 From: David Su Date: Tue, 26 Feb 2019 18:43:13 -0800 Subject: [PATCH 056/398] Clarifies Javadocs for setDeviceMobilityState() API Clarifies the meaning of high and low movement mobility states, and that the setDeviceMobilityState() should be called when transitioning between states. Bug: 122614678 Test: compiles Change-Id: Ife9920b81c985238931357ed978983a83d70ffef --- wifi/java/android/net/wifi/WifiManager.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index 6c645fc8ce5..5ca30fcbf0d 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -4575,7 +4575,8 @@ public class WifiManager { public static final int DEVICE_MOBILITY_STATE_UNKNOWN = 0; /** - * High movement device mobility state + * High movement device mobility state. + * e.g. on a bike, in a motor vehicle * * @see #setDeviceMobilityState(int) * @@ -4585,7 +4586,8 @@ public class WifiManager { public static final int DEVICE_MOBILITY_STATE_HIGH_MVMT = 1; /** - * Low movement device mobility state + * Low movement device mobility state. + * e.g. walking, running * * @see #setDeviceMobilityState(int) * @@ -4607,6 +4609,8 @@ public class WifiManager { /** * Updates the device mobility state. Wifi uses this information to adjust the interval between * Wifi scans in order to balance power consumption with scan accuracy. + * The default mobility state when the device boots is {@link #DEVICE_MOBILITY_STATE_UNKNOWN}. + * This API should be called whenever there is a change in the mobility state. * @param state the updated device mobility state * @hide */ -- GitLab From 6593694f97be68d5d24744d6312cd56bf0fb2a9e Mon Sep 17 00:00:00 2001 From: Dichen Zhang Date: Wed, 27 Feb 2019 11:01:40 -0800 Subject: [PATCH 057/398] revert "HLS seeking: call readAt() on new thread" This reverts commit Ie527aeaff91e1b82c7e707a6feaf79548c7ac380 Bug: 119900000 Test: go/ag/5140159 Change-Id: Ia8b2f3efc2f3551e749c16c6c8dfbc070f8bb980 --- .../android/media/MediaHTTPConnection.java | 21 ++----------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/media/java/android/media/MediaHTTPConnection.java b/media/java/android/media/MediaHTTPConnection.java index 5f324f7f97e..d72476269e1 100644 --- a/media/java/android/media/MediaHTTPConnection.java +++ b/media/java/android/media/MediaHTTPConnection.java @@ -37,7 +37,6 @@ import java.net.URL; import java.net.UnknownServiceException; import java.util.HashMap; import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; /** @hide */ public class MediaHTTPConnection extends IMediaHTTPConnection.Stub { @@ -67,7 +66,6 @@ public class MediaHTTPConnection extends IMediaHTTPConnection.Stub { // from com.squareup.okhttp.internal.http private final static int HTTP_TEMP_REDIRECT = 307; private final static int MAX_REDIRECTS = 20; - private AtomicBoolean mIsConnected = new AtomicBoolean(false); @UnsupportedAppUsage public MediaHTTPConnection() { @@ -91,7 +89,6 @@ public class MediaHTTPConnection extends IMediaHTTPConnection.Stub { mAllowCrossDomainRedirect = true; mURL = new URL(uri); mHeaders = convertHeaderStringToMap(headers); - mIsConnected.set(true); } catch (MalformedURLException e) { return null; } @@ -142,14 +139,7 @@ public class MediaHTTPConnection extends IMediaHTTPConnection.Stub { @Override @UnsupportedAppUsage public void disconnect() { - if (mIsConnected.getAndSet(false)) { - (new Thread() { - @Override - public void run() { - teardownConnection(); - } - }).start(); - } + teardownConnection(); mHeaders = null; mURL = null; } @@ -334,14 +324,7 @@ public class MediaHTTPConnection extends IMediaHTTPConnection.Stub { @Override @UnsupportedAppUsage public int readAt(long offset, int size) { - if (!mIsConnected.get()) { - return -1; - } - int result = native_readAt(offset, size); - if (!mIsConnected.get()) { - return -1; - } - return result; + return native_readAt(offset, size); } private int readAt(long offset, byte[] data, int size) { -- GitLab From 2d7de480a4f635bec420e51ca42cf0c3b2dfa569 Mon Sep 17 00:00:00 2001 From: jackqdyulei Date: Tue, 26 Feb 2019 13:34:27 -0800 Subject: [PATCH 058/398] Move MediaSessions from systemui to settingslib Also add javadocs to pass style check Bug: 126199571 Test: Build Change-Id: I78389834760e12fb73b0ae1c8565b8c5d42a5789 --- .../src/com/android/settingslib/volume/D.java | 23 +++ .../settingslib}/volume/MediaSessions.java | 99 ++++++---- .../com/android/settingslib/volume/Util.java | 187 ++++++++++++++++++ .../src/com/android/systemui/volume/Util.java | 144 +------------- .../volume/VolumeDialogControllerImpl.java | 1 + 5 files changed, 276 insertions(+), 178 deletions(-) create mode 100644 packages/SettingsLib/src/com/android/settingslib/volume/D.java rename packages/{SystemUI/src/com/android/systemui => SettingsLib/src/com/android/settingslib}/volume/MediaSessions.java (85%) create mode 100644 packages/SettingsLib/src/com/android/settingslib/volume/Util.java diff --git a/packages/SettingsLib/src/com/android/settingslib/volume/D.java b/packages/SettingsLib/src/com/android/settingslib/volume/D.java new file mode 100644 index 00000000000..7e0654d72b4 --- /dev/null +++ b/packages/SettingsLib/src/com/android/settingslib/volume/D.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settingslib.volume; + +import android.util.Log; + +class D { + public static boolean BUG = Log.isLoggable("volume", Log.DEBUG); +} diff --git a/packages/SystemUI/src/com/android/systemui/volume/MediaSessions.java b/packages/SettingsLib/src/com/android/settingslib/volume/MediaSessions.java similarity index 85% rename from packages/SystemUI/src/com/android/systemui/volume/MediaSessions.java rename to packages/SettingsLib/src/com/android/settingslib/volume/MediaSessions.java index 8b00eee29c6..4ed115405f5 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/MediaSessions.java +++ b/packages/SettingsLib/src/com/android/settingslib/volume/MediaSessions.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 The Android Open Source Project + * 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.volume; +package com.android.settingslib.volume; import android.app.PendingIntent; import android.content.Context; @@ -27,7 +27,6 @@ import android.media.IRemoteVolumeController; import android.media.MediaMetadata; import android.media.session.MediaController; import android.media.session.MediaController.PlaybackInfo; -import android.media.session.MediaSession; import android.media.session.MediaSession.QueueItem; import android.media.session.MediaSession.Token; import android.media.session.MediaSessionManager; @@ -41,7 +40,6 @@ import android.os.RemoteException; import android.util.Log; import java.io.PrintWriter; -import java.io.StringWriter; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -73,16 +71,24 @@ public class MediaSessions { mCallbacks = callbacks; } + /** + * Dump to {@code writer} + */ public void dump(PrintWriter writer) { writer.println(getClass().getSimpleName() + " state:"); - writer.print(" mInit: "); writer.println(mInit); - writer.print(" mRecords.size: "); writer.println(mRecords.size()); + writer.print(" mInit: "); + writer.println(mInit); + writer.print(" mRecords.size: "); + writer.println(mRecords.size()); int i = 0; for (MediaControllerRecord r : mRecords.values()) { dump(++i, writer, r.controller); } } + /** + * init MediaSessions + */ public void init() { if (D.BUG) Log.d(TAG, "init"); // will throw if no permission @@ -97,12 +103,18 @@ public class MediaSessions { mHandler.sendEmptyMessage(H.UPDATE_SESSIONS); } + /** + * Destroy MediaSessions + */ public void destroy() { if (D.BUG) Log.d(TAG, "destroy"); mInit = false; mMgr.removeOnActiveSessionsChangedListener(mSessionsListener); } + /** + * Set volume {@code level} to remote media {@code token} + */ public void setVolume(Token token, int level) { final MediaControllerRecord r = mRecords.get(token); if (r == null) { @@ -113,15 +125,17 @@ public class MediaSessions { r.controller.setVolumeTo(level, 0); } - private void onRemoteVolumeChangedH(MediaSession.Token sessionToken, int flags) { + private void onRemoteVolumeChangedH(Token sessionToken, int flags) { final MediaController controller = new MediaController(mContext, sessionToken); - if (D.BUG) Log.d(TAG, "remoteVolumeChangedH " + controller.getPackageName() + " " - + Util.audioManagerFlagsToString(flags)); + if (D.BUG) { + Log.d(TAG, "remoteVolumeChangedH " + controller.getPackageName() + " " + + Util.audioManagerFlagsToString(flags)); + } final Token token = controller.getSessionToken(); mCallbacks.onRemoteVolumeChanged(token, flags); } - private void onUpdateRemoteControllerH(MediaSession.Token sessionToken) { + private void onUpdateRemoteControllerH(Token sessionToken) { final MediaController controller = sessionToken != null ? new MediaController(mContext, sessionToken) : null; final String pkg = controller != null ? controller.getPackageName() : null; @@ -191,7 +205,8 @@ public class MediaSessions { if (appLabel.length() > 0) { return appLabel; } - } catch (NameNotFoundException e) { } + } catch (NameNotFoundException e) { + } return pkg; } @@ -240,29 +255,11 @@ public class MediaSessions { } } - public static void dumpMediaSessions(Context context) { - final MediaSessionManager mgr = (MediaSessionManager) context - .getSystemService(Context.MEDIA_SESSION_SERVICE); - try { - final List controllers = mgr.getActiveSessions(null); - final int N = controllers.size(); - if (D.BUG) Log.d(TAG, N + " controllers"); - for (int i = 0; i < N; i++) { - final StringWriter sw = new StringWriter(); - final PrintWriter pw = new PrintWriter(sw, true); - dump(i + 1, pw, controllers.get(i)); - if (D.BUG) Log.d(TAG, sw.toString()); - } - } catch (SecurityException e) { - Log.w(TAG, "Not allowed to get sessions", e); - } - } - private final class MediaControllerRecord extends MediaController.Callback { - private final MediaController controller; + public final MediaController controller; - private boolean sentRemote; - private String name; + public boolean sentRemote; + public String name; private MediaControllerRecord(MediaController controller) { this.controller = controller; @@ -274,8 +271,10 @@ public class MediaSessions { @Override public void onAudioInfoChanged(PlaybackInfo info) { - if (D.BUG) Log.d(TAG, cb("onAudioInfoChanged") + Util.playbackInfoToString(info) - + " sentRemote=" + sentRemote); + if (D.BUG) { + Log.d(TAG, cb("onAudioInfoChanged") + Util.playbackInfoToString(info) + + " sentRemote=" + sentRemote); + } final boolean remote = isRemote(info); if (!remote && sentRemote) { mCallbacks.onRemoteRemoved(controller.getSessionToken()); @@ -324,22 +323,22 @@ public class MediaSessions { private final OnActiveSessionsChangedListener mSessionsListener = new OnActiveSessionsChangedListener() { - @Override - public void onActiveSessionsChanged(List controllers) { - onActiveSessionsUpdatedH(controllers); - } - }; + @Override + public void onActiveSessionsChanged(List controllers) { + onActiveSessionsUpdatedH(controllers); + } + }; private final IRemoteVolumeController mRvc = new IRemoteVolumeController.Stub() { @Override - public void remoteVolumeChanged(MediaSession.Token sessionToken, int flags) + public void remoteVolumeChanged(Token sessionToken, int flags) throws RemoteException { mHandler.obtainMessage(H.REMOTE_VOLUME_CHANGED, flags, 0, sessionToken).sendToTarget(); } @Override - public void updateRemoteController(final MediaSession.Token sessionToken) + public void updateRemoteController(final Token sessionToken) throws RemoteException { mHandler.obtainMessage(H.UPDATE_REMOTE_CONTROLLER, sessionToken).sendToTarget(); } @@ -361,18 +360,32 @@ public class MediaSessions { onActiveSessionsUpdatedH(mMgr.getActiveSessions(null)); break; case REMOTE_VOLUME_CHANGED: - onRemoteVolumeChangedH((MediaSession.Token) msg.obj, msg.arg1); + onRemoteVolumeChangedH((Token) msg.obj, msg.arg1); break; case UPDATE_REMOTE_CONTROLLER: - onUpdateRemoteControllerH((MediaSession.Token) msg.obj); + onUpdateRemoteControllerH((Token) msg.obj); break; } } } + /** + * Callback for remote media sessions + */ public interface Callbacks { + /** + * Invoked when remote media session is updated + */ void onRemoteUpdate(Token token, String name, PlaybackInfo pi); + + /** + * Invoked when remote media session is removed + */ void onRemoteRemoved(Token t); + + /** + * Invoked when remote volume is changed + */ void onRemoteVolumeChanged(Token token, int flags); } diff --git a/packages/SettingsLib/src/com/android/settingslib/volume/Util.java b/packages/SettingsLib/src/com/android/settingslib/volume/Util.java new file mode 100644 index 00000000000..4e770aeb861 --- /dev/null +++ b/packages/SettingsLib/src/com/android/settingslib/volume/Util.java @@ -0,0 +1,187 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settingslib.volume; + +import android.content.Context; +import android.media.AudioManager; +import android.media.MediaMetadata; +import android.media.VolumeProvider; +import android.media.session.MediaController.PlaybackInfo; +import android.media.session.PlaybackState; +import android.telephony.TelephonyManager; +import android.widget.TextView; + +import java.util.Objects; + +/** + * Static helpers for the volume dialog. + */ +public class Util { + + private static final int[] AUDIO_MANAGER_FLAGS = new int[]{ + AudioManager.FLAG_SHOW_UI, + AudioManager.FLAG_VIBRATE, + AudioManager.FLAG_PLAY_SOUND, + AudioManager.FLAG_ALLOW_RINGER_MODES, + AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE, + AudioManager.FLAG_SHOW_VIBRATE_HINT, + AudioManager.FLAG_SHOW_SILENT_HINT, + AudioManager.FLAG_FROM_KEY, + AudioManager.FLAG_SHOW_UI_WARNINGS, + }; + + private static final String[] AUDIO_MANAGER_FLAG_NAMES = new String[]{ + "SHOW_UI", + "VIBRATE", + "PLAY_SOUND", + "ALLOW_RINGER_MODES", + "REMOVE_SOUND_AND_VIBRATE", + "SHOW_VIBRATE_HINT", + "SHOW_SILENT_HINT", + "FROM_KEY", + "SHOW_UI_WARNINGS", + }; + + /** + * Extract log tag from {@code c} + */ + public static String logTag(Class c) { + final String tag = "vol." + c.getSimpleName(); + return tag.length() < 23 ? tag : tag.substring(0, 23); + } + + /** + * Convert media metadata to string + */ + public static String mediaMetadataToString(MediaMetadata metadata) { + if (metadata == null) return null; + return metadata.getDescription().toString(); + } + + /** + * Convert playback info to string + */ + public static String playbackInfoToString(PlaybackInfo info) { + if (info == null) return null; + final String type = playbackInfoTypeToString(info.getPlaybackType()); + final String vc = volumeProviderControlToString(info.getVolumeControl()); + return String.format("PlaybackInfo[vol=%s,max=%s,type=%s,vc=%s],atts=%s", + info.getCurrentVolume(), info.getMaxVolume(), type, vc, info.getAudioAttributes()); + } + + /** + * Convert type of playback info to string + */ + public static String playbackInfoTypeToString(int type) { + switch (type) { + case PlaybackInfo.PLAYBACK_TYPE_LOCAL: + return "LOCAL"; + case PlaybackInfo.PLAYBACK_TYPE_REMOTE: + return "REMOTE"; + default: + return "UNKNOWN_" + type; + } + } + + /** + * Convert state of playback info to string + */ + public static String playbackStateStateToString(int state) { + switch (state) { + case PlaybackState.STATE_NONE: + return "STATE_NONE"; + case PlaybackState.STATE_STOPPED: + return "STATE_STOPPED"; + case PlaybackState.STATE_PAUSED: + return "STATE_PAUSED"; + case PlaybackState.STATE_PLAYING: + return "STATE_PLAYING"; + default: + return "UNKNOWN_" + state; + } + } + + /** + * Convert volume provider control to string + */ + public static String volumeProviderControlToString(int control) { + switch (control) { + case VolumeProvider.VOLUME_CONTROL_ABSOLUTE: + return "VOLUME_CONTROL_ABSOLUTE"; + case VolumeProvider.VOLUME_CONTROL_FIXED: + return "VOLUME_CONTROL_FIXED"; + case VolumeProvider.VOLUME_CONTROL_RELATIVE: + return "VOLUME_CONTROL_RELATIVE"; + default: + return "VOLUME_CONTROL_UNKNOWN_" + control; + } + } + + /** + * Convert {@link PlaybackState} to string + */ + public static String playbackStateToString(PlaybackState playbackState) { + if (playbackState == null) return null; + return playbackStateStateToString(playbackState.getState()) + " " + playbackState; + } + + /** + * Convert audio manager flags to string + */ + public static String audioManagerFlagsToString(int value) { + return bitFieldToString(value, AUDIO_MANAGER_FLAGS, AUDIO_MANAGER_FLAG_NAMES); + } + + protected static String bitFieldToString(int value, int[] values, String[] names) { + if (value == 0) return ""; + final StringBuilder sb = new StringBuilder(); + for (int i = 0; i < values.length; i++) { + if ((value & values[i]) != 0) { + if (sb.length() > 0) sb.append(','); + sb.append(names[i]); + } + value &= ~values[i]; + } + if (value != 0) { + if (sb.length() > 0) sb.append(','); + sb.append("UNKNOWN_").append(value); + } + return sb.toString(); + } + + private static CharSequence emptyToNull(CharSequence str) { + return str == null || str.length() == 0 ? null : str; + } + + /** + * Set text for specific {@link TextView} + */ + public static boolean setText(TextView tv, CharSequence text) { + if (Objects.equals(emptyToNull(tv.getText()), emptyToNull(text))) return false; + tv.setText(text); + return true; + } + + /** + * Return {@code true} if it is voice capable + */ + public static boolean isVoiceCapable(Context context) { + final TelephonyManager telephony = + (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); + return telephony != null && telephony.isVoiceCapable(); + } +} diff --git a/packages/SystemUI/src/com/android/systemui/volume/Util.java b/packages/SystemUI/src/com/android/systemui/volume/Util.java index c6d62181540..7edb5a55a9a 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/Util.java +++ b/packages/SystemUI/src/com/android/systemui/volume/Util.java @@ -16,52 +16,13 @@ package com.android.systemui.volume; -import android.content.Context; import android.media.AudioManager; -import android.media.MediaMetadata; -import android.media.VolumeProvider; -import android.media.session.MediaController.PlaybackInfo; -import android.media.session.PlaybackState; -import android.telephony.TelephonyManager; import android.view.View; -import android.widget.TextView; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Locale; -import java.util.Objects; /** * Static helpers for the volume dialog. */ -class Util { - - // Note: currently not shown (only used in the text footer) - private static final SimpleDateFormat HMMAA = new SimpleDateFormat("h:mm aa", Locale.US); - - private static int[] AUDIO_MANAGER_FLAGS = new int[] { - AudioManager.FLAG_SHOW_UI, - AudioManager.FLAG_VIBRATE, - AudioManager.FLAG_PLAY_SOUND, - AudioManager.FLAG_ALLOW_RINGER_MODES, - AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE, - AudioManager.FLAG_SHOW_VIBRATE_HINT, - AudioManager.FLAG_SHOW_SILENT_HINT, - AudioManager.FLAG_FROM_KEY, - AudioManager.FLAG_SHOW_UI_WARNINGS, - }; - - private static String[] AUDIO_MANAGER_FLAG_NAMES = new String[] { - "SHOW_UI", - "VIBRATE", - "PLAY_SOUND", - "ALLOW_RINGER_MODES", - "REMOVE_SOUND_AND_VIBRATE", - "SHOW_VIBRATE_HINT", - "SHOW_SILENT_HINT", - "FROM_KEY", - "SHOW_UI_WARNINGS", - }; +class Util extends com.android.settingslib.volume.Util { public static String logTag(Class c) { final String tag = "vol." + c.getSimpleName(); @@ -70,106 +31,19 @@ class Util { public static String ringerModeToString(int ringerMode) { switch (ringerMode) { - case AudioManager.RINGER_MODE_SILENT: return "RINGER_MODE_SILENT"; - case AudioManager.RINGER_MODE_VIBRATE: return "RINGER_MODE_VIBRATE"; - case AudioManager.RINGER_MODE_NORMAL: return "RINGER_MODE_NORMAL"; - default: return "RINGER_MODE_UNKNOWN_" + ringerMode; - } - } - - public static String mediaMetadataToString(MediaMetadata metadata) { - if (metadata == null) return null; - return metadata.getDescription().toString(); - } - - public static String playbackInfoToString(PlaybackInfo info) { - if (info == null) return null; - final String type = playbackInfoTypeToString(info.getPlaybackType()); - final String vc = volumeProviderControlToString(info.getVolumeControl()); - return String.format("PlaybackInfo[vol=%s,max=%s,type=%s,vc=%s],atts=%s", - info.getCurrentVolume(), info.getMaxVolume(), type, vc, info.getAudioAttributes()); - } - - public static String playbackInfoTypeToString(int type) { - switch (type) { - case PlaybackInfo.PLAYBACK_TYPE_LOCAL: return "LOCAL"; - case PlaybackInfo.PLAYBACK_TYPE_REMOTE: return "REMOTE"; - default: return "UNKNOWN_" + type; - } - } - - public static String playbackStateStateToString(int state) { - switch (state) { - case PlaybackState.STATE_NONE: return "STATE_NONE"; - case PlaybackState.STATE_STOPPED: return "STATE_STOPPED"; - case PlaybackState.STATE_PAUSED: return "STATE_PAUSED"; - case PlaybackState.STATE_PLAYING: return "STATE_PLAYING"; - default: return "UNKNOWN_" + state; - } - } - - public static String volumeProviderControlToString(int control) { - switch (control) { - case VolumeProvider.VOLUME_CONTROL_ABSOLUTE: return "VOLUME_CONTROL_ABSOLUTE"; - case VolumeProvider.VOLUME_CONTROL_FIXED: return "VOLUME_CONTROL_FIXED"; - case VolumeProvider.VOLUME_CONTROL_RELATIVE: return "VOLUME_CONTROL_RELATIVE"; - default: return "VOLUME_CONTROL_UNKNOWN_" + control; - } - } - - public static String playbackStateToString(PlaybackState playbackState) { - if (playbackState == null) return null; - return playbackStateStateToString(playbackState.getState()) + " " + playbackState; - } - - public static String audioManagerFlagsToString(int value) { - return bitFieldToString(value, AUDIO_MANAGER_FLAGS, AUDIO_MANAGER_FLAG_NAMES); - } - - private static String bitFieldToString(int value, int[] values, String[] names) { - if (value == 0) return ""; - final StringBuilder sb = new StringBuilder(); - for (int i = 0; i < values.length; i++) { - if ((value & values[i]) != 0) { - if (sb.length() > 0) sb.append(','); - sb.append(names[i]); - } - value &= ~values[i]; - } - if (value != 0) { - if (sb.length() > 0) sb.append(','); - sb.append("UNKNOWN_").append(value); + case AudioManager.RINGER_MODE_SILENT: + return "RINGER_MODE_SILENT"; + case AudioManager.RINGER_MODE_VIBRATE: + return "RINGER_MODE_VIBRATE"; + case AudioManager.RINGER_MODE_NORMAL: + return "RINGER_MODE_NORMAL"; + default: + return "RINGER_MODE_UNKNOWN_" + ringerMode; } - return sb.toString(); - } - - public static String getShortTime(long millis) { - return HMMAA.format(new Date(millis)); - } - - private static CharSequence emptyToNull(CharSequence str) { - return str == null || str.length() == 0 ? null : str; - } - - public static boolean setText(TextView tv, CharSequence text) { - if (Objects.equals(emptyToNull(tv.getText()), emptyToNull(text))) return false; - tv.setText(text); - return true; } public static final void setVisOrGone(View v, boolean vis) { if (v == null || (v.getVisibility() == View.VISIBLE) == vis) return; v.setVisibility(vis ? View.VISIBLE : View.GONE); } - - public static final void setVisOrInvis(View v, boolean vis) { - if (v == null || (v.getVisibility() == View.VISIBLE) == vis) return; - v.setVisibility(vis ? View.VISIBLE : View.INVISIBLE); - } - - public static boolean isVoiceCapable(Context context) { - final TelephonyManager telephony = - (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); - return telephony != null && telephony.isVoiceCapable(); - } } diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java index 32bc01cdfdf..4c16297154f 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java @@ -53,6 +53,7 @@ import android.util.Log; import android.view.accessibility.AccessibilityManager; import com.android.internal.annotations.GuardedBy; +import com.android.settingslib.volume.MediaSessions; import com.android.systemui.Dumpable; import com.android.systemui.R; import com.android.systemui.SysUiServiceProvider; -- GitLab From 4f270f03253dc0b45a23c63c28b61ef2217c7729 Mon Sep 17 00:00:00 2001 From: George Hodulik Date: Tue, 26 Feb 2019 16:11:40 -0800 Subject: [PATCH 059/398] Set Sharesheet to use AiAi for DirectShare targets. This change is a no-op since no apps use DirectShare yet. Test: Flashed recently, used test directshare apk and confirmed that the app prediction service returned the test apk targets. Change-Id: Iee9ad25ab473b7752380b2e4f89100a281331f7f --- core/java/com/android/internal/app/ChooserActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java index 89e3d6b6460..a5a1dd993e0 100644 --- a/core/java/com/android/internal/app/ChooserActivity.java +++ b/core/java/com/android/internal/app/ChooserActivity.java @@ -135,7 +135,7 @@ public class ChooserActivity extends ResolverActivity { * {@link AppPredictionManager} will be queried for direct share targets. */ // TODO(b/123089490): Replace with system flag - private static final boolean USE_PREDICTION_MANAGER_FOR_DIRECT_TARGETS = false; + private static final boolean USE_PREDICTION_MANAGER_FOR_DIRECT_TARGETS = true; // TODO(b/123088566) Share these in a better way. private static final String APP_PREDICTION_SHARE_UI_SURFACE = "share"; public static final String LAUNCH_LOCATON_DIRECT_SHARE = "direct_share"; -- GitLab From f4f8a5613026345f505cb88daa2d34a3eeb7f2c1 Mon Sep 17 00:00:00 2001 From: Evan Laird Date: Wed, 27 Feb 2019 14:34:19 -0500 Subject: [PATCH 060/398] Themed battery drawable tweaks - Scale the stroke protection so things look good in settings - use .also insteady `by lazy` for initialization - fix level coloring problem - Join.ROUND stroke join for the fill protection Test: visual Change-Id: I55bea1956dcaccc8505fede695bf86bb518f8df0 --- .../graph/ThemedBatteryDrawable.kt | 44 +++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/packages/SettingsLib/src/com/android/settingslib/graph/ThemedBatteryDrawable.kt b/packages/SettingsLib/src/com/android/settingslib/graph/ThemedBatteryDrawable.kt index 337106bb5f1..911cfcd115f 100644 --- a/packages/SettingsLib/src/com/android/settingslib/graph/ThemedBatteryDrawable.kt +++ b/packages/SettingsLib/src/com/android/settingslib/graph/ThemedBatteryDrawable.kt @@ -87,7 +87,8 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int) invalidateSelf() } - open var criticalLevel: Int = 0 + open var criticalLevel: Int = context.resources.getInteger( + com.android.internal.R.integer.config_criticalBatteryWarningLevel) var charging = false set(value) { @@ -101,46 +102,40 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int) postInvalidate() } - private val fillColorStrokePaint: Paint by lazy { - val p = Paint(Paint.ANTI_ALIAS_FLAG) + private val fillColorStrokePaint = Paint(Paint.ANTI_ALIAS_FLAG).also { p -> p.color = frameColor p.isDither = true p.strokeWidth = 5f p.style = Paint.Style.STROKE p.blendMode = BlendMode.SRC p.strokeMiter = 5f - p + p.strokeJoin = Paint.Join.ROUND } - private val fillColorStrokeProtection: Paint by lazy { - val p = Paint(Paint.ANTI_ALIAS_FLAG) + private val fillColorStrokeProtection = Paint(Paint.ANTI_ALIAS_FLAG).also { p -> p.isDither = true p.strokeWidth = 5f p.style = Paint.Style.STROKE p.blendMode = BlendMode.CLEAR p.strokeMiter = 5f - p + p.strokeJoin = Paint.Join.ROUND } - private val fillPaint: Paint by lazy { - val p = Paint(Paint.ANTI_ALIAS_FLAG) + private val fillPaint = Paint(Paint.ANTI_ALIAS_FLAG).also { p -> p.color = frameColor p.alpha = 255 p.isDither = true p.strokeWidth = 0f p.style = Paint.Style.FILL_AND_STROKE - p } // Only used if dualTone is set to true - private val dualToneBackgroundFill: Paint by lazy { - val p = Paint(Paint.ANTI_ALIAS_FLAG) + private val dualToneBackgroundFill = Paint(Paint.ANTI_ALIAS_FLAG).also { p -> p.color = frameColor p.alpha = 255 p.isDither = true p.strokeWidth = 0f p.style = Paint.Style.FILL_AND_STROKE - p } init { @@ -165,9 +160,6 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int) levels.recycle() colors.recycle() - criticalLevel = context.resources.getInteger( - com.android.internal.R.integer.config_criticalBatteryWarningLevel) - loadPaths() } @@ -254,7 +246,7 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int) private fun batteryColorForLevel(level: Int): Int { return when { - charging || powerSaveEnabled -> fillPaint.color + charging || powerSaveEnabled -> fillColor else -> getColorForLevel(level) } } @@ -347,6 +339,9 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int) backgroundColor = bgColor dualToneBackgroundFill.color = bgColor + // Also update the level color, since fillColor may have changed + levelColor = batteryColorForLevel(level) + invalidateSelf() } @@ -360,7 +355,7 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int) if (b.isEmpty) { scaleMatrix.setScale(1f, 1f) } else { - scaleMatrix.setScale((b.right / Companion.WIDTH), (b.bottom / Companion.HEIGHT)) + scaleMatrix.setScale((b.right / WIDTH), (b.bottom / HEIGHT)) } perimeterPath.transform(scaleMatrix, scaledPerimeter) @@ -368,6 +363,14 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int) scaledFill.computeBounds(fillRect, true) boltPath.transform(scaleMatrix, scaledBolt) plusPath.transform(scaleMatrix, scaledPlus) + + // It is expected that this view only ever scale by the same factor in each dimension, so + // just pick one to scale the strokeWidths + val scaledStrokeWidth = + Math.max(b.right / WIDTH * PROTECTION_STROKE_WIDTH, PROTECTION_MIN_STROKE_WIDTH) + + fillColorStrokePaint.strokeWidth = scaledStrokeWidth + fillColorStrokeProtection.strokeWidth = scaledStrokeWidth } private fun loadPaths() { @@ -400,5 +403,10 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int) private const val WIDTH = 12f private const val HEIGHT = 20f private const val CRITICAL_LEVEL = 15 + // On a 12x20 grid, how wide to make the fill protection stroke. + // Scales when our size changes + private const val PROTECTION_STROKE_WIDTH = 1.4f + // Arbitrarily chosen for visibility at small sizes + private const val PROTECTION_MIN_STROKE_WIDTH = 5f } } -- GitLab From f4b9070e9b24c9a8f7e43663925e5f8eb1011a5c Mon Sep 17 00:00:00 2001 From: Martijn Coenen Date: Wed, 27 Feb 2019 12:37:08 +0100 Subject: [PATCH 061/398] Add PARSE_IS_SYSTEM_DIR when parsing /system APEXes. To prevent us from reading all APEXes at boot and verifying their integrity; this is not necessary because /system is protected by dm-verity. Bug: 126514108 Bug: 117823094 Test: verified system APEXes are no longer read entirely at boot Change-Id: I1dcf97ce63505602d2de1913e728a1d57b0e9964 --- .../java/android/content/pm/PackageParser.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 0f67262bf90..77131dfd633 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -8435,6 +8435,21 @@ public class PackageParser { public static PackageInfo generatePackageInfoFromApex(File apexFile, boolean collectCerts) throws PackageParserException { PackageInfo pi = new PackageInfo(); + int parseFlags = 0; + if (collectCerts) { + parseFlags |= PARSE_COLLECT_CERTIFICATES; + try { + if (apexFile.getCanonicalPath().startsWith("/system")) { + // Don't need verify the APK integrity of APEXes on /system, just like + // we don't do that for APKs. + // TODO(b/126514108): we may be able to do this for APEXes on /data as well. + parseFlags |= PARSE_IS_SYSTEM_DIR; + } + } catch (IOException e) { + throw new PackageParserException(INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION, + "Failed to get path for " + apexFile.getPath(), e); + } + } // TODO(b/123086053) properly fill in the ApplicationInfo with data from AndroidManifest // Add ApplicationInfo to the PackageInfo. @@ -8449,8 +8464,7 @@ public class PackageParser { // TODO(b/123052859): We should avoid these repeated calls to parseApkLite each time // we want to generate information for APEX modules. - PackageParser.ApkLite apk = PackageParser.parseApkLite(apexFile, - collectCerts ? PackageParser.PARSE_COLLECT_CERTIFICATES : 0); + PackageParser.ApkLite apk = PackageParser.parseApkLite(apexFile, parseFlags); pi.packageName = apk.packageName; ai.packageName = apk.packageName; -- GitLab From d005334b92ba4fed680bae6581f5a782ec6d832f Mon Sep 17 00:00:00 2001 From: Aaron Heuckroth Date: Tue, 26 Feb 2019 14:30:40 -0500 Subject: [PATCH 062/398] Initialize rotation when HardwareUILayout is constructed in landscape. Test: Automated tests pass, classic power menu appears correct when created in landscape mode. Fixes: 126220438 Fixes: 126221661 Change-Id: I63863c21d09b35100a9ed89d0c2ed0d3868e3aea --- .../android/systemui/HardwareUiLayout.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/HardwareUiLayout.java b/packages/SystemUI/src/com/android/systemui/HardwareUiLayout.java index 2a1d066d356..f5451e952dd 100644 --- a/packages/SystemUI/src/com/android/systemui/HardwareUiLayout.java +++ b/packages/SystemUI/src/com/android/systemui/HardwareUiLayout.java @@ -63,6 +63,9 @@ public class HardwareUiLayout extends MultiListLayout implements Tunable { public HardwareUiLayout(Context context, AttributeSet attrs) { super(context, attrs); + // Manually re-initialize mRotation to portrait-mode, since this view must always + // be constructed in portrait mode and rotated into the correct initial position. + mRotation = ROTATION_NONE; updateSettings(); } @@ -172,6 +175,10 @@ public class HardwareUiLayout extends MultiListLayout implements Tunable { mSeparatedView.setBackground(mSeparatedViewBackground); updateEdgeMargin(mEdgeBleed ? 0 : getEdgePadding()); mOldHeight = mList.getMeasuredHeight(); + + // Must be called to initialize view rotation correctly. + // Requires LayoutParams, hence why this isn't called during the constructor. + updateRotation(); } else { return; } @@ -189,7 +196,18 @@ public class HardwareUiLayout extends MultiListLayout implements Tunable { mSwapOrientation = swapOrientation; } - @Override + private void updateRotation() { + int rotation = RotationUtils.getRotation(getContext()); + if (rotation != mRotation) { + rotate(mRotation, rotation); + mRotation = rotation; + } + } + + /** + * Requires LayoutParams to be set to work correctly, and therefore must be run after after + * the HardwareUILayout has been added to the view hierarchy. + */ protected void rotate(int from, int to) { super.rotate(from, to); if (from != ROTATION_NONE && to != ROTATION_NONE) { @@ -522,4 +540,4 @@ public class HardwareUiLayout extends MultiListLayout implements Tunable { inoutInfo.contentInsets.set(mList.getLeft(), mList.getTop(), 0, getBottom() - mList.getBottom()); }; -} +} \ No newline at end of file -- GitLab From 9c98582dd6e46ba24823f3bb29a28da3eb8a32df Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Wed, 27 Feb 2019 13:12:30 -0800 Subject: [PATCH 063/398] Check for hardware before authenticating On devices with no hardware, the service is null. We need to return the correct error in that case. Fixes: 126392276 Test: Builds Change-Id: I184bd6afce71bf36b659286cd7dd6aa17d490657 --- .../android/hardware/biometrics/BiometricPrompt.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/java/android/hardware/biometrics/BiometricPrompt.java b/core/java/android/hardware/biometrics/BiometricPrompt.java index baf972b2657..8629210c2a7 100644 --- a/core/java/android/hardware/biometrics/BiometricPrompt.java +++ b/core/java/android/hardware/biometrics/BiometricPrompt.java @@ -616,8 +616,15 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan mExecutor = executor; mAuthenticationCallback = callback; final long sessionId = crypto != null ? crypto.getOpId() : 0; - mService.authenticate(mToken, sessionId, userId, mBiometricServiceReceiver, - mContext.getOpPackageName(), mBundle); + if (BiometricManager.hasBiometrics(mContext)) { + mService.authenticate(mToken, sessionId, userId, mBiometricServiceReceiver, + mContext.getOpPackageName(), mBundle); + } else { + mExecutor.execute(() -> { + callback.onAuthenticationError(BiometricPrompt.BIOMETRIC_ERROR_HW_NOT_PRESENT, + mContext.getString(R.string.biometric_error_hw_unavailable)); + }); + } } catch (RemoteException e) { Log.e(TAG, "Remote exception while authenticating", e); mExecutor.execute(() -> { -- GitLab From 8c360174f5dfc63185a8756d7ac4068f3d8c46a8 Mon Sep 17 00:00:00 2001 From: jackqdyulei Date: Wed, 27 Feb 2019 10:43:57 -0800 Subject: [PATCH 064/398] Update MediaSessions to add some methods Also move drawable to settingslib Bug: 126199571 Test: Build Change-Id: I20d06c179b7cd67ef97cde1d04e26a120ffdd4ae --- data/etc/com.android.settings.xml | 1 + .../{SystemUI => SettingsLib}/res/drawable/ic_volume_remote.xml | 0 .../res/drawable/ic_volume_remote_mute.xml | 0 3 files changed, 1 insertion(+) rename packages/{SystemUI => SettingsLib}/res/drawable/ic_volume_remote.xml (100%) rename packages/{SystemUI => SettingsLib}/res/drawable/ic_volume_remote_mute.xml (100%) diff --git a/data/etc/com.android.settings.xml b/data/etc/com.android.settings.xml index 2110a8fa7e3..3e53a383854 100644 --- a/data/etc/com.android.settings.xml +++ b/data/etc/com.android.settings.xml @@ -33,6 +33,7 @@ + diff --git a/packages/SystemUI/res/drawable/ic_volume_remote.xml b/packages/SettingsLib/res/drawable/ic_volume_remote.xml similarity index 100% rename from packages/SystemUI/res/drawable/ic_volume_remote.xml rename to packages/SettingsLib/res/drawable/ic_volume_remote.xml diff --git a/packages/SystemUI/res/drawable/ic_volume_remote_mute.xml b/packages/SettingsLib/res/drawable/ic_volume_remote_mute.xml similarity index 100% rename from packages/SystemUI/res/drawable/ic_volume_remote_mute.xml rename to packages/SettingsLib/res/drawable/ic_volume_remote_mute.xml -- GitLab From fc9a21de684f24f0005be43d0113b504bd5990fc Mon Sep 17 00:00:00 2001 From: Alan Stokes Date: Wed, 27 Feb 2019 21:30:59 +0000 Subject: [PATCH 065/398] Detect native code loading by untrusted_app. Modify the regex to cover untrusted_app as well as untrusted_app_25 and untrusted_app_27. Add a test to verify. Bug: 126536482 Test: atest DynamicCodeLoggerIntegrationsTests Change-Id: Ie4cbabfb55a5e78868cc6ee8ec46270ab3bf75d1 --- .../server/pm/DynamicCodeLoggingService.java | 2 +- .../DynamicCodeLoggerIntegrationTests.java | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/pm/DynamicCodeLoggingService.java b/services/core/java/com/android/server/pm/DynamicCodeLoggingService.java index d53d81cf086..a1ff76fc8c0 100644 --- a/services/core/java/com/android/server/pm/DynamicCodeLoggingService.java +++ b/services/core/java/com/android/server/pm/DynamicCodeLoggingService.java @@ -61,7 +61,7 @@ public class DynamicCodeLoggingService extends JobService { private static final Pattern EXECUTE_NATIVE_AUDIT_PATTERN = Pattern.compile(".*\\bavc: granted \\{ execute(?:_no_trans|) \\} .*" + "\\bpath=(?:\"([^\" ]*)\"|([0-9A-F]+)) .*" - + "\\bscontext=u:r:untrusted_app_2(?:5|7):.*" + + "\\bscontext=u:r:untrusted_app(?:_25|_27)?:.*" + "\\btcontext=u:object_r:app_data_file:.*" + "\\btclass=file\\b.*"); diff --git a/tests/DynamicCodeLoggerIntegrationTests/src/com/android/server/pm/dex/DynamicCodeLoggerIntegrationTests.java b/tests/DynamicCodeLoggerIntegrationTests/src/com/android/server/pm/dex/DynamicCodeLoggerIntegrationTests.java index 8ef15d869a0..4f9aeea5bdb 100644 --- a/tests/DynamicCodeLoggerIntegrationTests/src/com/android/server/pm/dex/DynamicCodeLoggerIntegrationTests.java +++ b/tests/DynamicCodeLoggerIntegrationTests/src/com/android/server/pm/dex/DynamicCodeLoggerIntegrationTests.java @@ -234,6 +234,34 @@ public final class DynamicCodeLoggerIntegrationTests { expectedNameHash, expectedContentHash); } + @Test + public void testGeneratesEvents_spoofed_validFile_untrustedApp() throws Exception { + File privateCopyFile = privateFile("spoofed2"); + + String expectedContentHash = copyAndHashResource( + "/DynamicCodeLoggerNativeExecutable", privateCopyFile); + + EventLog.writeEvent(EventLog.getTagCode("auditd"), + "type=1400 avc: granted { execute_no_trans } " + + "path=\"" + privateCopyFile + "\" " + + "scontext=u:r:untrusted_app: " + + "tcontext=u:object_r:app_data_file: " + + "tclass=file "); + + String expectedNameHash = + "3E57AA59249154C391316FDCF07C1D499C26A564E4D305833CCD9A98ED895AC9"; + + // Run the job to scan generated audit log entries + runDynamicCodeLoggingJob(AUDIT_WATCHING_JOB_ID); + + // And then make sure we log events about it + long previousEventNanos = mostRecentEventTimeNanos(); + runDynamicCodeLoggingJob(IDLE_LOGGING_JOB_ID); + + assertDclLoggedSince(previousEventNanos, DCL_NATIVE_SUBTAG, + expectedNameHash, expectedContentHash); + } + @Test public void testGeneratesEvents_spoofed_pathTraversal() throws Exception { File privateDir = privateFile("x").getParentFile(); -- GitLab From b58d3fea2651622ad047acebc9cb23c137f4d50d Mon Sep 17 00:00:00 2001 From: Jeff Vander Stoep Date: Wed, 27 Feb 2019 13:31:22 -0800 Subject: [PATCH 066/398] getConnectionOwnerUid: Clarify documentation Test: build Bug: 117573763 Change-Id: Ia899a541987b9c72a83287ed69fc47ab4d38f680 --- core/java/android/net/ConnectivityManager.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index 92b30a440d6..ae356f8310c 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -4275,6 +4275,8 @@ public class ConnectivityManager { * @return {@code uid} if the connection is found and the app has permission to observe it * (e.g., if it is associated with the calling VPN app's tunnel) or * {@link android.os.Process#INVALID_UID} if the connection is not found. + * Throws {@link SecurityException} if the caller is not the active VPN for the current user. + * Throws {@link IllegalArgumentException} if an unsupported protocol is requested. */ public int getConnectionOwnerUid(int protocol, @NonNull InetSocketAddress local, @NonNull InetSocketAddress remote) { -- GitLab From eb6051c74e56de1b075ad4fb3567959b9b0baeda Mon Sep 17 00:00:00 2001 From: Brad Stenning Date: Wed, 27 Feb 2019 13:46:11 -0800 Subject: [PATCH 067/398] UI was being created before the provisioned stated was checked. Test: manual Change-Id: Ide19ed44610524d53d2336060fda3193238919b0 (cherry picked from commit 590936fe54af7a1b4746cff3f7a6f317480147ab) --- packages/CarSystemUI/res/drawable/car_ic_selection_bg.xml | 2 +- .../com/android/systemui/statusbar/car/CarStatusBar.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/CarSystemUI/res/drawable/car_ic_selection_bg.xml b/packages/CarSystemUI/res/drawable/car_ic_selection_bg.xml index 781beaf9626..12993f5b8b7 100644 --- a/packages/CarSystemUI/res/drawable/car_ic_selection_bg.xml +++ b/packages/CarSystemUI/res/drawable/car_ic_selection_bg.xml @@ -20,7 +20,7 @@ android:viewportHeight="70.0" android:viewportWidth="70.0"> Date: Wed, 27 Feb 2019 16:44:04 -0500 Subject: [PATCH 068/398] Add preview for default clock face. Bug: 123704608 Test: Checked image provided by ContentProvider Change-Id: I485e02c287a0d26e1eb0e37cf2a519f009a708ca --- .../layout/default_clock_preview.xml | 30 ++++++ .../android/keyguard/clock/ClockManager.java | 24 +++-- .../clock/DefaultClockController.java | 98 +++++++++++++++++++ 3 files changed, 145 insertions(+), 7 deletions(-) create mode 100644 packages/SystemUI/res-keyguard/layout/default_clock_preview.xml create mode 100644 packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java diff --git a/packages/SystemUI/res-keyguard/layout/default_clock_preview.xml b/packages/SystemUI/res-keyguard/layout/default_clock_preview.xml new file mode 100644 index 00000000000..3e6dd13e4b9 --- /dev/null +++ b/packages/SystemUI/res-keyguard/layout/default_clock_preview.xml @@ -0,0 +1,30 @@ + + + + + + diff --git a/packages/SystemUI/src/com/android/keyguard/clock/ClockManager.java b/packages/SystemUI/src/com/android/keyguard/clock/ClockManager.java index 3827e445c13..42a6e22c264 100644 --- a/packages/SystemUI/src/com/android/keyguard/clock/ClockManager.java +++ b/packages/SystemUI/src/com/android/keyguard/clock/ClockManager.java @@ -60,6 +60,9 @@ import javax.inject.Singleton; @Singleton public final class ClockManager { + private static final String TAG = "ClockOptsProvider"; + private static final String DEFAULT_CLOCK_ID = "default"; + private final List mClockInfos = new ArrayList<>(); /** * Map from expected value stored in settings to supplier of custom clock face. @@ -67,6 +70,7 @@ public final class ClockManager { private final Map> mClocks = new ArrayMap<>(); @Nullable private ClockPlugin mCurrentClock; + private final LayoutInflater mLayoutInflater; private final ContentResolver mContentResolver; private final SettingsWrapper mSettingsWrapper; /** @@ -122,11 +126,11 @@ public final class ClockManager { Resources res = context.getResources(); mClockInfos.add(ClockInfo.builder() - .setName("default") + .setName(DEFAULT_CLOCK_ID) .setTitle(res.getString(R.string.clock_title_default)) - .setId("default") + .setId(DEFAULT_CLOCK_ID) .setThumbnail(() -> BitmapFactory.decodeResource(res, R.drawable.default_thumbnail)) - .setPreview(() -> BitmapFactory.decodeResource(res, R.drawable.default_preview)) + .setPreview(() -> getClockPreview(DEFAULT_CLOCK_ID)) .build()); mClockInfos.add(ClockInfo.builder() .setName("bubble") @@ -151,12 +155,15 @@ public final class ClockManager { .build()); LayoutInflater layoutInflater = injectionInflater.injectable(LayoutInflater.from(context)); + mClocks.put(DEFAULT_CLOCK_ID, + () -> DefaultClockController.build(layoutInflater)); mClocks.put(BubbleClockController.class.getName(), () -> BubbleClockController.build(layoutInflater)); mClocks.put(StretchAnalogClockController.class.getName(), () -> StretchAnalogClockController.build(layoutInflater)); mClocks.put(TypeClockController.class.getName(), () -> TypeClockController.build(layoutInflater)); + mLayoutInflater = layoutInflater; // Store the size of the display for generation of clock preview. DisplayMetrics dm = res.getDisplayMetrics(); @@ -218,6 +225,7 @@ public final class ClockManager { */ @Nullable private Bitmap getClockPreview(String clockId) { + Bitmap bitmap = Bitmap.createBitmap(mWidth, mHeight, Config.ARGB_8888); Supplier supplier = mClocks.get(clockId); if (supplier == null) { return null; @@ -240,15 +248,13 @@ public final class ClockManager { plugin.dozeTimeTick(); // Draw clock view hierarchy to canvas. - Bitmap bitmap = Bitmap.createBitmap(mWidth, mHeight, Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); + canvas.drawColor(Color.BLACK); dispatchVisibilityAggregated(clockView, true); clockView.measure(MeasureSpec.makeMeasureSpec(mWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(mHeight, MeasureSpec.EXACTLY)); clockView.layout(0, 0, mWidth, mHeight); - canvas.drawColor(Color.BLACK); clockView.draw(canvas); - return bitmap; } @@ -299,7 +305,11 @@ public final class ClockManager { private void reload() { mCurrentClock = getClockPlugin(); - notifyClockChanged(mCurrentClock); + if (mCurrentClock instanceof DefaultClockController) { + notifyClockChanged(null); + } else { + notifyClockChanged(mCurrentClock); + } } private ClockPlugin getClockPlugin() { diff --git a/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java new file mode 100644 index 00000000000..a4766dba599 --- /dev/null +++ b/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.keyguard.clock; + +import android.graphics.Paint.Style; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.TextView; + +import com.android.keyguard.R; +import com.android.systemui.plugins.ClockPlugin; + +import java.util.TimeZone; + +/** + * Plugin for the default clock face used only to provide a preview. + */ +public class DefaultClockController implements ClockPlugin { + + /** + * Root view of preview. + */ + private View mView; + /** + * Text clock in preview view hierarchy. + */ + private TextView mTextTime; + private TextView mTextDate; + + private DefaultClockController() {} + + /** + * Create a DefaultClockController instance. + * + * @param inflater Inflater used to inflate custom clock views. + */ + public static DefaultClockController build(LayoutInflater inflater) { + DefaultClockController controller = new DefaultClockController(); + controller.createViews(inflater); + return controller; + } + + private void createViews(LayoutInflater inflater) { + mView = inflater.inflate(R.layout.default_clock_preview, null); + mTextTime = mView.findViewById(R.id.time); + mTextDate = mView.findViewById(R.id.date); + } + + @Override + public View getView() { + return null; + } + + @Override + public View getBigClockView() { + return mView; + } + + @Override + public void setStyle(Style style) {} + + @Override + public void setTextColor(int color) { + mTextTime.setTextColor(color); + mTextDate.setTextColor(color); + } + + @Override + public void setColorPalette(boolean supportsDarkText, int[] colorPalette) {} + + @Override + public void dozeTimeTick() { + } + + @Override + public void setDarkAmount(float darkAmount) {} + + @Override + public void onTimeZoneChanged(TimeZone timeZone) {} + + @Override + public boolean shouldShowStatusArea() { + return true; + } +} -- GitLab From 7b3f4ec0750ca9b92806b9544024f6bcb57507c2 Mon Sep 17 00:00:00 2001 From: Brad Stenning Date: Fri, 15 Feb 2019 09:09:46 -0800 Subject: [PATCH 069/398] Moving car Theme resources that are designed to be overlayed out of the car_product static overlay to framework/base/res such that they can be targeted for RRO Bug:112592617 Bug:112592617 Test: Manual on emulator Change-Id: I425d76aabf76ccc465bf984d04e586ce90416b66 (cherry picked from commit 9eeda1ccc0eaccd2aaf1ef904efa5fcb35b53636) --- .../car_borderless_button_text_color.xml | 20 +++ .../res/color-car/car_button_text_color.xml | 20 +++ core/res/res/color-car/car_switch.xml | 24 +++ .../drawable-car/car_button_background.xml | 36 ++++ core/res/res/drawable-car/car_checkbox.xml | 23 +++ .../car_dialog_button_background.xml | 22 +++ .../res/drawable-car/car_seekbar_thumb.xml | 24 +++ .../drawable-car/car_seekbar_thumb_dark.xml | 24 +++ .../drawable-car/car_seekbar_thumb_light.xml | 24 +++ .../res/drawable-car/car_seekbar_track.xml | 43 +++++ .../drawable-car/car_seekbar_track_dark.xml | 44 +++++ .../drawable-car/car_seekbar_track_light.xml | 44 +++++ .../res/res/drawable-car/car_switch_thumb.xml | 25 +++ core/res/res/layout-car/car_preference.xml | 72 ++++++++ .../layout-car/car_preference_category.xml | 65 +++++++ .../car_resolver_different_item_header.xml | 33 ++++ core/res/res/layout-car/car_resolver_list.xml | 112 ++++++++++++ .../car_resolver_list_with_default.xml | 161 ++++++++++++++++++ 18 files changed, 816 insertions(+) create mode 100644 core/res/res/color-car/car_borderless_button_text_color.xml create mode 100644 core/res/res/color-car/car_button_text_color.xml create mode 100644 core/res/res/color-car/car_switch.xml create mode 100644 core/res/res/drawable-car/car_button_background.xml create mode 100644 core/res/res/drawable-car/car_checkbox.xml create mode 100644 core/res/res/drawable-car/car_dialog_button_background.xml create mode 100644 core/res/res/drawable-car/car_seekbar_thumb.xml create mode 100644 core/res/res/drawable-car/car_seekbar_thumb_dark.xml create mode 100644 core/res/res/drawable-car/car_seekbar_thumb_light.xml create mode 100644 core/res/res/drawable-car/car_seekbar_track.xml create mode 100644 core/res/res/drawable-car/car_seekbar_track_dark.xml create mode 100644 core/res/res/drawable-car/car_seekbar_track_light.xml create mode 100644 core/res/res/drawable-car/car_switch_thumb.xml create mode 100644 core/res/res/layout-car/car_preference.xml create mode 100644 core/res/res/layout-car/car_preference_category.xml create mode 100644 core/res/res/layout-car/car_resolver_different_item_header.xml create mode 100644 core/res/res/layout-car/car_resolver_list.xml create mode 100644 core/res/res/layout-car/car_resolver_list_with_default.xml diff --git a/core/res/res/color-car/car_borderless_button_text_color.xml b/core/res/res/color-car/car_borderless_button_text_color.xml new file mode 100644 index 00000000000..1cdd6cd901a --- /dev/null +++ b/core/res/res/color-car/car_borderless_button_text_color.xml @@ -0,0 +1,20 @@ + + + + + + + diff --git a/core/res/res/color-car/car_button_text_color.xml b/core/res/res/color-car/car_button_text_color.xml new file mode 100644 index 00000000000..eda54d9abbb --- /dev/null +++ b/core/res/res/color-car/car_button_text_color.xml @@ -0,0 +1,20 @@ + + + + + + + diff --git a/core/res/res/color-car/car_switch.xml b/core/res/res/color-car/car_switch.xml new file mode 100644 index 00000000000..ebf3841ca9d --- /dev/null +++ b/core/res/res/color-car/car_switch.xml @@ -0,0 +1,24 @@ + + + + + + + diff --git a/core/res/res/drawable-car/car_button_background.xml b/core/res/res/drawable-car/car_button_background.xml new file mode 100644 index 00000000000..3e2610c5047 --- /dev/null +++ b/core/res/res/drawable-car/car_button_background.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/core/res/res/drawable-car/car_checkbox.xml b/core/res/res/drawable-car/car_checkbox.xml new file mode 100644 index 00000000000..651e6786c46 --- /dev/null +++ b/core/res/res/drawable-car/car_checkbox.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/core/res/res/drawable-car/car_dialog_button_background.xml b/core/res/res/drawable-car/car_dialog_button_background.xml new file mode 100644 index 00000000000..dc742d57b14 --- /dev/null +++ b/core/res/res/drawable-car/car_dialog_button_background.xml @@ -0,0 +1,22 @@ + + + + + + + diff --git a/core/res/res/drawable-car/car_seekbar_thumb.xml b/core/res/res/drawable-car/car_seekbar_thumb.xml new file mode 100644 index 00000000000..fe9c7732bdc --- /dev/null +++ b/core/res/res/drawable-car/car_seekbar_thumb.xml @@ -0,0 +1,24 @@ + + + + + + + diff --git a/core/res/res/drawable-car/car_seekbar_thumb_dark.xml b/core/res/res/drawable-car/car_seekbar_thumb_dark.xml new file mode 100644 index 00000000000..8ac9975816a --- /dev/null +++ b/core/res/res/drawable-car/car_seekbar_thumb_dark.xml @@ -0,0 +1,24 @@ + + + + + + + diff --git a/core/res/res/drawable-car/car_seekbar_thumb_light.xml b/core/res/res/drawable-car/car_seekbar_thumb_light.xml new file mode 100644 index 00000000000..b212b766b9f --- /dev/null +++ b/core/res/res/drawable-car/car_seekbar_thumb_light.xml @@ -0,0 +1,24 @@ + + + + + + + diff --git a/core/res/res/drawable-car/car_seekbar_track.xml b/core/res/res/drawable-car/car_seekbar_track.xml new file mode 100644 index 00000000000..5ea7b2257fe --- /dev/null +++ b/core/res/res/drawable-car/car_seekbar_track.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/res/res/drawable-car/car_seekbar_track_dark.xml b/core/res/res/drawable-car/car_seekbar_track_dark.xml new file mode 100644 index 00000000000..19f6340521c --- /dev/null +++ b/core/res/res/drawable-car/car_seekbar_track_dark.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/res/res/drawable-car/car_seekbar_track_light.xml b/core/res/res/drawable-car/car_seekbar_track_light.xml new file mode 100644 index 00000000000..d23ca33e04c --- /dev/null +++ b/core/res/res/drawable-car/car_seekbar_track_light.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/res/res/drawable-car/car_switch_thumb.xml b/core/res/res/drawable-car/car_switch_thumb.xml new file mode 100644 index 00000000000..03efc189aa9 --- /dev/null +++ b/core/res/res/drawable-car/car_switch_thumb.xml @@ -0,0 +1,25 @@ + + + + + + + diff --git a/core/res/res/layout-car/car_preference.xml b/core/res/res/layout-car/car_preference.xml new file mode 100644 index 00000000000..939c3fbc521 --- /dev/null +++ b/core/res/res/layout-car/car_preference.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + diff --git a/core/res/res/layout-car/car_preference_category.xml b/core/res/res/layout-car/car_preference_category.xml new file mode 100644 index 00000000000..d1f73421e18 --- /dev/null +++ b/core/res/res/layout-car/car_preference_category.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + diff --git a/core/res/res/layout-car/car_resolver_different_item_header.xml b/core/res/res/layout-car/car_resolver_different_item_header.xml new file mode 100644 index 00000000000..222ecc68979 --- /dev/null +++ b/core/res/res/layout-car/car_resolver_different_item_header.xml @@ -0,0 +1,33 @@ + + + \ No newline at end of file diff --git a/core/res/res/layout-car/car_resolver_list.xml b/core/res/res/layout-car/car_resolver_list.xml new file mode 100644 index 00000000000..15a864505d3 --- /dev/null +++ b/core/res/res/layout-car/car_resolver_list.xml @@ -0,0 +1,112 @@ + + + + + + + + + + +