Merge "Add two classes to blacklist" into qt-dev
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index e3c2f42..f7608f5 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -4919,6 +4919,8 @@
UNKNOWN = 0;
SOME = 1;
FULL = 2;
+ PERSISTENT = 3;
+ BFGS = 4;
}
optional Action action = 3;
diff --git a/core/java/android/accounts/Account.java b/core/java/android/accounts/Account.java
index 2637764..c822d20 100644
--- a/core/java/android/accounts/Account.java
+++ b/core/java/android/accounts/Account.java
@@ -93,6 +93,12 @@
public Account(Parcel in) {
this.name = in.readString();
this.type = in.readString();
+ if (TextUtils.isEmpty(name)) {
+ throw new android.os.BadParcelableException("the name must not be empty: " + name);
+ }
+ if (TextUtils.isEmpty(type)) {
+ throw new android.os.BadParcelableException("the type must not be empty: " + type);
+ }
this.accessId = in.readString();
if (accessId != null) {
synchronized (sAccessedAccounts) {
diff --git a/core/java/android/service/autofill/AutofillService.java b/core/java/android/service/autofill/AutofillService.java
index 2b7e8b8..5a91802 100644
--- a/core/java/android/service/autofill/AutofillService.java
+++ b/core/java/android/service/autofill/AutofillService.java
@@ -674,6 +674,8 @@
* Called when the Android system disconnects from the service.
*
* <p> At this point this service may no longer be an active {@link AutofillService}.
+ * It should not make calls on {@link AutofillManager} that requires the caller to be
+ * the current service.
*/
public void onDisconnected() {
}
diff --git a/core/java/android/service/autofill/augmented/AugmentedAutofillService.java b/core/java/android/service/autofill/augmented/AugmentedAutofillService.java
index 96b861b..b00eb8a 100644
--- a/core/java/android/service/autofill/augmented/AugmentedAutofillService.java
+++ b/core/java/android/service/autofill/augmented/AugmentedAutofillService.java
@@ -41,6 +41,7 @@
import android.util.SparseArray;
import android.util.TimeUtils;
import android.view.autofill.AutofillId;
+import android.view.autofill.AutofillManager;
import android.view.autofill.AutofillValue;
import android.view.autofill.IAugmentedAutofillManagerClient;
import android.view.autofill.IAutofillWindowPresenter;
@@ -183,6 +184,8 @@
* Called when the Android system disconnects from the service.
*
* <p> At this point this service may no longer be an active {@link AugmentedAutofillService}.
+ * It should not make calls on {@link AutofillManager} that requires the caller to be
+ * the current service.
*/
public void onDisconnected() {
}
diff --git a/core/java/android/service/contentcapture/ContentCaptureService.java b/core/java/android/service/contentcapture/ContentCaptureService.java
index dc57a15..5be73b9 100644
--- a/core/java/android/service/contentcapture/ContentCaptureService.java
+++ b/core/java/android/service/contentcapture/ContentCaptureService.java
@@ -37,7 +37,6 @@
import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
-import android.service.autofill.AutofillService;
import android.util.Log;
import android.util.Slog;
import android.util.SparseIntArray;
@@ -350,7 +349,9 @@
/**
* Called when the Android system disconnects from the service.
*
- * <p> At this point this service may no longer be an active {@link AutofillService}.
+ * <p> At this point this service may no longer be an active {@link ContentCaptureService}.
+ * It should not make calls on {@link ContentCaptureManager} that requires the caller to be
+ * the current service.
*/
public void onDisconnected() {
Slog.i(TAG, "unbinding from " + getClass().getName());
diff --git a/core/java/com/android/internal/app/procstats/ProcessState.java b/core/java/com/android/internal/app/procstats/ProcessState.java
index b26efc0..2f9136a 100644
--- a/core/java/com/android/internal/app/procstats/ProcessState.java
+++ b/core/java/com/android/internal/app/procstats/ProcessState.java
@@ -78,8 +78,8 @@
STATE_PERSISTENT, // ActivityManager.PROCESS_STATE_PERSISTENT_UI
STATE_TOP, // ActivityManager.PROCESS_STATE_TOP
STATE_IMPORTANT_FOREGROUND, // ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE_LOCATION
- STATE_IMPORTANT_FOREGROUND, // ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE
STATE_IMPORTANT_FOREGROUND, // ActivityManager.PROCESS_STATE_BOUND_TOP
+ STATE_IMPORTANT_FOREGROUND, // ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE
STATE_IMPORTANT_FOREGROUND, // ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE
STATE_IMPORTANT_FOREGROUND, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND
STATE_IMPORTANT_BACKGROUND, // ActivityManager.PROCESS_STATE_IMPORTANT_BACKGROUND
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp
index 13bcbf6..3135c62 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -317,7 +317,8 @@
buffer->getPixelFormat(),
(jint)buffer->getUsage(),
(jlong)buffer.get(),
- namedColorSpace);
+ namedColorSpace,
+ false /* capturedSecureLayers */);
}
static void nativeApplyTransaction(JNIEnv* env, jclass clazz, jlong transactionObj, jboolean sync) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index d11eab7..562e535 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -401,7 +401,11 @@
@Override
public void getOutline(View view, Outline outline) {
if (mAmbientState.isDarkAtAll() || !mShowDarkShelf) {
- outline.setRoundRect(mBackgroundAnimationRect, mCornerRadius);
+ float xProgress = mDarkXInterpolator.getInterpolation(
+ (1 - mLinearDarkAmount) * mBackgroundXFactor);
+ outline.setRoundRect(mBackgroundAnimationRect,
+ MathUtils.lerp(mCornerRadius / 2.0f, mCornerRadius,
+ xProgress));
} else {
ViewOutlineProvider.BACKGROUND.getOutline(view, outline);
}
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index c647e2e..ac584e9 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -1304,12 +1304,12 @@
return;
}
if (VDBG) {
- log("notifyUserMobileDataStateChangedForSubscriberPhoneID: subId=" + phoneId
- + " state=" + state);
+ log("notifyUserMobileDataStateChangedForSubscriberPhoneID: PhoneId=" + phoneId
+ + " subId=" + subId + " state=" + state);
}
synchronized (mRecords) {
if (validatePhoneId(phoneId)) {
- mMessageWaiting[phoneId] = state;
+ mUserMobileDataState[phoneId] = state;
for (Record r : mRecords) {
if (r.matchPhoneStateListenerEvent(
PhoneStateListener.LISTEN_USER_MOBILE_DATA_STATE) &&
diff --git a/services/core/java/com/android/server/am/OomAdjuster.java b/services/core/java/com/android/server/am/OomAdjuster.java
index 5d47c9d..44d435f 100644
--- a/services/core/java/com/android/server/am/OomAdjuster.java
+++ b/services/core/java/com/android/server/am/OomAdjuster.java
@@ -1262,15 +1262,16 @@
// processes). These should not bring the current process
// into the top state, since they are not on top. Instead
// give them the best bound state after that.
+ final int bestState = cr.hasFlag(Context.BIND_INCLUDE_CAPABILITIES)
+ ? PROCESS_STATE_FOREGROUND_SERVICE_LOCATION
+ : PROCESS_STATE_BOUND_FOREGROUND_SERVICE;
if ((cr.flags & Context.BIND_FOREGROUND_SERVICE) != 0) {
- clientProcState =
- PROCESS_STATE_BOUND_FOREGROUND_SERVICE;
+ clientProcState = bestState;
} else if (mService.mWakefulness
== PowerManagerInternal.WAKEFULNESS_AWAKE
&& (cr.flags & Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE)
!= 0) {
- clientProcState =
- PROCESS_STATE_BOUND_FOREGROUND_SERVICE;
+ clientProcState = bestState;
} else {
clientProcState =
PROCESS_STATE_IMPORTANT_FOREGROUND;
diff --git a/services/core/java/com/android/server/attention/AttentionManagerService.java b/services/core/java/com/android/server/attention/AttentionManagerService.java
index bc78d1a..3dbea0d 100644
--- a/services/core/java/com/android/server/attention/AttentionManagerService.java
+++ b/services/core/java/com/android/server/attention/AttentionManagerService.java
@@ -22,7 +22,6 @@
import static android.service.attention.AttentionService.ATTENTION_FAILURE_UNKNOWN;
import android.Manifest;
-import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.TestApi;
import android.annotation.UserIdInt;
@@ -51,6 +50,7 @@
import android.provider.Settings;
import android.service.attention.AttentionService;
import android.service.attention.AttentionService.AttentionFailureCodes;
+import android.service.attention.AttentionService.AttentionSuccessCodes;
import android.service.attention.IAttentionCallback;
import android.service.attention.IAttentionService;
import android.text.TextUtils;
@@ -75,6 +75,7 @@
*/
public class AttentionManagerService extends SystemService {
private static final String LOG_TAG = "AttentionManagerService";
+ private static final boolean DEBUG = false;
/**
* DeviceConfig flag name, allows a CTS to inject a fake implementation.
@@ -156,7 +157,11 @@
/**
* Checks whether user attention is at the screen and calls in the provided callback.
*
- * @return {@code true} if the framework was able to send the provided callback to the service
+ * Calling this multiple times quickly in a row will result in either a) returning a cached
+ * value, if present, or b) returning {@code false} because only one active request at a time is
+ * allowed.
+ *
+ * @return {@code true} if the framework was able to dispatch the request
*/
private boolean checkAttention(long timeout, AttentionCallbackInternal callbackInternal) {
Preconditions.checkNotNull(callbackInternal);
@@ -182,54 +187,30 @@
return false;
}
- if (userState.mService == null) {
- // make sure every callback is called back
- if (userState.mPendingAttentionCheck != null) {
- userState.mPendingAttentionCheck.cancel(
- ATTENTION_FAILURE_CANCELLED);
- }
- // fire the check when the service is started
- userState.mPendingAttentionCheck = new PendingAttentionCheck(
- callbackInternal, () -> checkAttention(timeout, callbackInternal));
- } else {
- try {
- // throttle frequent requests
- final AttentionCheckCache cache = userState.mAttentionCheckCache;
- if (cache != null && now < cache.mLastComputed + STALE_AFTER_MILLIS) {
- callbackInternal.onSuccess(cache.mResult, cache.mTimestamp);
- return true;
- }
+ // throttle frequent requests
+ final AttentionCheckCache cache = userState.mAttentionCheckCache;
+ if (cache != null && now < cache.mLastComputed + STALE_AFTER_MILLIS) {
+ callbackInternal.onSuccess(cache.mResult, cache.mTimestamp);
+ return true;
+ }
+ // prevent spamming with multiple requests, only one at a time is allowed
+ if (userState.mCurrentAttentionCheck != null) {
+ if (!userState.mCurrentAttentionCheck.mIsDispatched
+ || !userState.mCurrentAttentionCheck.mIsFulfilled) {
+ return false;
+ }
+ }
+
+ userState.mCurrentAttentionCheck = createAttentionCheck(callbackInternal, userState);
+
+ if (userState.mService != null) {
+ try {
// schedule request cancellation if not returned by that point yet
cancelAfterTimeoutLocked(timeout);
-
- userState.mCurrentAttentionCheck = new AttentionCheck(callbackInternal,
- new IAttentionCallback.Stub() {
- @Override
- public void onSuccess(int result, long timestamp) {
- callbackInternal.onSuccess(result, timestamp);
- synchronized (mLock) {
- userState.mAttentionCheckCache = new AttentionCheckCache(
- SystemClock.uptimeMillis(), result,
- timestamp);
- userState.mCurrentAttentionCheckIsFulfilled = true;
- }
- StatsLog.write(
- StatsLog.ATTENTION_MANAGER_SERVICE_RESULT_REPORTED,
- result);
- }
-
- @Override
- public void onFailure(int error) {
- callbackInternal.onFailure(error);
- userState.mCurrentAttentionCheckIsFulfilled = true;
- StatsLog.write(
- StatsLog.ATTENTION_MANAGER_SERVICE_RESULT_REPORTED,
- error);
- }
- });
userState.mService.checkAttention(
userState.mCurrentAttentionCheck.mIAttentionCallback);
+ userState.mCurrentAttentionCheck.mIsDispatched = true;
} catch (RemoteException e) {
Slog.e(LOG_TAG, "Cannot call into the AttentionService");
return false;
@@ -239,6 +220,44 @@
}
}
+ private AttentionCheck createAttentionCheck(AttentionCallbackInternal callbackInternal,
+ UserState userState) {
+ final IAttentionCallback iAttentionCallback = new IAttentionCallback.Stub() {
+ @Override
+ public void onSuccess(@AttentionSuccessCodes int result, long timestamp) {
+ // the callback might have been cancelled already
+ if (!userState.mCurrentAttentionCheck.mIsFulfilled) {
+ callbackInternal.onSuccess(result, timestamp);
+ userState.mCurrentAttentionCheck.mIsFulfilled = true;
+ }
+
+ synchronized (mLock) {
+ userState.mAttentionCheckCache = new AttentionCheckCache(
+ SystemClock.uptimeMillis(), result,
+ timestamp);
+ }
+ StatsLog.write(
+ StatsLog.ATTENTION_MANAGER_SERVICE_RESULT_REPORTED,
+ result);
+ }
+
+ @Override
+ public void onFailure(@AttentionFailureCodes int error) {
+ // the callback might have been cancelled already
+ if (!userState.mCurrentAttentionCheck.mIsFulfilled) {
+ callbackInternal.onFailure(error);
+ userState.mCurrentAttentionCheck.mIsFulfilled = true;
+ }
+
+ StatsLog.write(
+ StatsLog.ATTENTION_MANAGER_SERVICE_RESULT_REPORTED,
+ error);
+ }
+ };
+
+ return new AttentionCheck(callbackInternal, iAttentionCallback);
+ }
+
/** Cancels the specified attention check. */
private void cancelAttentionCheck(AttentionCallbackInternal callbackInternal) {
synchronized (mLock) {
@@ -246,25 +265,13 @@
if (userState == null) {
return;
}
- if (userState.mService == null) {
- if (userState.mPendingAttentionCheck != null
- && userState.mPendingAttentionCheck.mCallbackInternal.equals(
- callbackInternal)) {
- userState.mPendingAttentionCheck.cancel(ATTENTION_FAILURE_UNKNOWN);
- userState.mPendingAttentionCheck = null;
- }
+
+ if (!userState.mCurrentAttentionCheck.mCallbackInternal.equals(callbackInternal)) {
+ Slog.e(LOG_TAG, "Cannot cancel a non-current request");
return;
}
- if (userState.mCurrentAttentionCheck.mCallbackInternal.equals(callbackInternal)) {
- try {
- userState.mService.cancelAttentionCheck(
- userState.mCurrentAttentionCheck.mIAttentionCallback);
- } catch (RemoteException e) {
- Slog.e(LOG_TAG, "Cannot call into the AttentionService");
- }
- } else {
- Slog.e(LOG_TAG, "Cannot cancel a non-current request");
- }
+
+ cancel(userState);
}
}
@@ -272,6 +279,9 @@
private void disableSelf() {
final long identity = Binder.clearCallingIdentity();
try {
+ if (DEBUG) {
+ Slog.d(LOG_TAG, "Disabling self.");
+ }
Settings.System.putInt(mContext.getContentResolver(), ADAPTIVE_SLEEP, 0);
} finally {
Binder.restoreCallingIdentity(identity);
@@ -428,34 +438,21 @@
}
}
- private static final class PendingAttentionCheck {
- private final AttentionCallbackInternal mCallbackInternal;
- private final Runnable mRunnable;
-
- PendingAttentionCheck(AttentionCallbackInternal callbackInternal,
- Runnable runnable) {
- mCallbackInternal = callbackInternal;
- mRunnable = runnable;
- }
-
- void cancel(@AttentionFailureCodes int failureCode) {
- mCallbackInternal.onFailure(failureCode);
- }
-
- void run() {
- mRunnable.run();
- }
- }
-
private static final class AttentionCheck {
private final AttentionCallbackInternal mCallbackInternal;
private final IAttentionCallback mIAttentionCallback;
+ private boolean mIsDispatched;
+ private boolean mIsFulfilled;
AttentionCheck(AttentionCallbackInternal callbackInternal,
IAttentionCallback iAttentionCallback) {
mCallbackInternal = callbackInternal;
mIAttentionCallback = iAttentionCallback;
}
+
+ void cancelInternal() {
+ mCallbackInternal.onFailure(ATTENTION_FAILURE_CANCELLED);
+ }
}
private static final class UserState {
@@ -469,11 +466,6 @@
@GuardedBy("mLock")
AttentionCheck mCurrentAttentionCheck;
@GuardedBy("mLock")
- boolean mCurrentAttentionCheckIsFulfilled;
-
- @GuardedBy("mLock")
- PendingAttentionCheck mPendingAttentionCheck;
- @GuardedBy("mLock")
AttentionCheckCache mAttentionCheckCache;
@UserIdInt
@@ -491,9 +483,17 @@
@GuardedBy("mLock")
private void handlePendingCallbackLocked() {
- if (mService != null && mPendingAttentionCheck != null) {
- mPendingAttentionCheck.run();
- mPendingAttentionCheck = null;
+ if (!mCurrentAttentionCheck.mIsDispatched) {
+ if (mService != null) {
+ try {
+ mService.checkAttention(mCurrentAttentionCheck.mIAttentionCallback);
+ mCurrentAttentionCheck.mIsDispatched = true;
+ } catch (RemoteException e) {
+ Slog.e(LOG_TAG, "Cannot call into the AttentionService");
+ }
+ } else {
+ mCurrentAttentionCheck.mCallbackInternal.onFailure(ATTENTION_FAILURE_UNKNOWN);
+ }
}
}
@@ -526,7 +526,6 @@
pw.printPair("userId", mUserId);
synchronized (mLock) {
pw.printPair("binding", mBinding);
- pw.printPair("isAttentionCheckPending", mPendingAttentionCheck != null);
}
}
@@ -586,14 +585,7 @@
// Callee is no longer interested in the attention check result - cancel.
case ATTENTION_CHECK_TIMEOUT: {
synchronized (mLock) {
- final UserState userState = peekCurrentUserStateLocked();
- if (userState != null) {
- // If not called back already.
- if (!userState.mCurrentAttentionCheckIsFulfilled) {
- cancel(userState, AttentionService.ATTENTION_FAILURE_TIMED_OUT);
- }
-
- }
+ cancel(peekCurrentUserStateLocked());
}
}
break;
@@ -604,19 +596,30 @@
}
}
- private void cancel(@NonNull UserState userState, @AttentionFailureCodes int failureCode) {
- if (userState.mService != null) {
- try {
- userState.mService.cancelAttentionCheck(
- userState.mCurrentAttentionCheck.mIAttentionCallback);
- } catch (RemoteException e) {
- Slog.e(LOG_TAG, "Unable to cancel attention check");
- }
+ private void cancel(UserState userState) {
+ if (userState == null || userState.mCurrentAttentionCheck == null) {
+ return;
+ }
- if (userState.mPendingAttentionCheck != null) {
- userState.mPendingAttentionCheck.cancel(failureCode);
- userState.mPendingAttentionCheck = null;
+ if (userState.mCurrentAttentionCheck.mIsFulfilled) {
+ if (DEBUG) {
+ Slog.d(LOG_TAG, "Trying to cancel the check that has been already fulfilled.");
}
+ return;
+ }
+ userState.mCurrentAttentionCheck.mIsFulfilled = true;
+
+ if (userState.mService == null) {
+ userState.mCurrentAttentionCheck.cancelInternal();
+ return;
+ }
+
+ try {
+ userState.mService.cancelAttentionCheck(
+ userState.mCurrentAttentionCheck.mIAttentionCallback);
+ } catch (RemoteException e) {
+ Slog.e(LOG_TAG, "Unable to cancel attention check");
+ userState.mCurrentAttentionCheck.cancelInternal();
}
}
@@ -626,7 +629,12 @@
if (userState == null) {
return;
}
- cancel(userState, ATTENTION_FAILURE_UNKNOWN);
+
+ cancel(userState);
+
+ if (userState.mService == null) {
+ return;
+ }
mContext.unbindService(userState.mConnection);
userState.mConnection.cleanupService();
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 32781a9..3fc2d37 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -855,8 +855,7 @@
public void onSystemReady() {
mSystemReady = true;
- sendMsg(mAudioHandler, MSG_LOAD_SOUND_EFFECTS, SENDMSG_QUEUE,
- 0, 0, null, 0);
+ scheduleLoadSoundEffects();
mDeviceBroker.onSystemReady();
@@ -3225,6 +3224,14 @@
}
/**
+ * Schedule loading samples into the soundpool.
+ * This method can be overridden to schedule loading at a later time.
+ */
+ protected void scheduleLoadSoundEffects() {
+ sendMsg(mAudioHandler, MSG_LOAD_SOUND_EFFECTS, SENDMSG_QUEUE, 0, 0, null, 0);
+ }
+
+ /**
* Unloads samples from the sound pool.
* This method can be called to free some memory when
* sound effects are disabled.
diff --git a/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceController.java b/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceController.java
index e7181e2..c32ae97 100644
--- a/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceController.java
+++ b/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceController.java
@@ -271,7 +271,7 @@
final long time = System.currentTimeMillis();
float ambientColorTemperature = mColorTemperatureFilter.getEstimate(time);
- if (mAmbientToDisplayColorTemperatureSpline != null) {
+ if (mAmbientToDisplayColorTemperatureSpline != null && ambientColorTemperature != -1.0f) {
ambientColorTemperature =
mAmbientToDisplayColorTemperatureSpline.interpolate(ambientColorTemperature);
}
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
index 647e952..6f1929f 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
@@ -231,6 +231,7 @@
Context.BIND_AUTO_CREATE
| Context.BIND_TREAT_LIKE_ACTIVITY
| Context.BIND_FOREGROUND_SERVICE
+ | Context.BIND_INCLUDE_CAPABILITIES
| Context.BIND_SHOWING_UI
| Context.BIND_SCHEDULE_LIKE_TOP_APP;
diff --git a/services/core/java/com/android/server/location/GnssNetworkConnectivityHandler.java b/services/core/java/com/android/server/location/GnssNetworkConnectivityHandler.java
index ab75b21..2948aaf 100644
--- a/services/core/java/com/android/server/location/GnssNetworkConnectivityHandler.java
+++ b/services/core/java/com/android/server/location/GnssNetworkConnectivityHandler.java
@@ -199,29 +199,27 @@
}
/**
- * called from native code to update AGPS status
+ * Called from native code to update AGPS connection status, or to request or release a SUPL
+ * connection.
+ *
+ * <p>Note: {@code suplIpAddr} parameter is not present from IAGnssCallback.hal@2.0 onwards
+ * and is set to {@code null}.
*/
void onReportAGpsStatus(int agpsType, int agpsStatus, byte[] suplIpAddr) {
+ if (DEBUG) Log.d(TAG, "AGPS_DATA_CONNECTION: " + agpsDataConnStatusAsString(agpsStatus));
switch (agpsStatus) {
case GPS_REQUEST_AGPS_DATA_CONN:
- if (DEBUG) Log.d(TAG, "GPS_REQUEST_AGPS_DATA_CONN");
runOnHandler(() -> handleRequestSuplConnection(agpsType, suplIpAddr));
break;
case GPS_RELEASE_AGPS_DATA_CONN:
- if (DEBUG) Log.d(TAG, "GPS_RELEASE_AGPS_DATA_CONN");
runOnHandler(() -> handleReleaseSuplConnection(GPS_RELEASE_AGPS_DATA_CONN));
break;
case GPS_AGPS_DATA_CONNECTED:
- if (DEBUG) Log.d(TAG, "GPS_AGPS_DATA_CONNECTED");
- break;
case GPS_AGPS_DATA_CONN_DONE:
- if (DEBUG) Log.d(TAG, "GPS_AGPS_DATA_CONN_DONE");
- break;
case GPS_AGPS_DATA_CONN_FAILED:
- if (DEBUG) Log.d(TAG, "GPS_AGPS_DATA_CONN_FAILED");
break;
default:
- if (DEBUG) Log.d(TAG, "Received Unknown AGPS status: " + agpsStatus);
+ Log.w(TAG, "Received unknown AGPS status: " + agpsStatus);
}
}
@@ -459,11 +457,17 @@
}
mAGpsDataConnectionState = AGPS_DATA_CONNECTION_OPENING;
- NetworkRequest.Builder requestBuilder = new NetworkRequest.Builder();
- requestBuilder.addCapability(getNetworkCapability(mAGpsType));
- NetworkRequest request = requestBuilder.build();
+ // The NetworkRequest.Builder class is not used to construct the network request because
+ // the ConnectivityService requires the network request to be constructed in this way
+ // to extend support for requestRouteToHostAddress() method for pre-gnss@2.0 devices.
+ NetworkCapabilities networkCapabilities = new NetworkCapabilities();
+ networkCapabilities.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR);
+ networkCapabilities.addCapability(getNetworkCapability(mAGpsType));
+ NetworkRequest networkRequest = new NetworkRequest(networkCapabilities,
+ getLegacyDataConnectionType(agpsType), ConnectivityManager.REQUEST_ID_UNSET,
+ NetworkRequest.Type.REQUEST);
mConnMgr.requestNetwork(
- request,
+ networkRequest,
mSuplConnectivityCallback,
mHandler,
SUPL_NETWORK_REQUEST_TIMEOUT_MILLIS);
@@ -483,6 +487,19 @@
}
}
+ private int getLegacyDataConnectionType(int agpsType) {
+ switch (agpsType) {
+ case AGPS_TYPE_C2K:
+ case AGPS_TYPE_SUPL:
+ return ConnectivityManager.TYPE_MOBILE_SUPL;
+ case AGPS_TYPE_EIMS:
+ return ConnectivityManager.TYPE_MOBILE_EMERGENCY;
+ case AGPS_TYPE_IMS:
+ return ConnectivityManager.TYPE_MOBILE_IMS;
+ default:
+ throw new IllegalArgumentException("agpsType: " + agpsType);
+ }
+ }
private void handleReleaseSuplConnection(int agpsDataConnStatus) {
if (DEBUG) {
String message = String.format(
@@ -546,7 +563,7 @@
case AGPS_DATA_CONNECTION_OPENING:
return "OPENING";
default:
- return "<Unknown>";
+ return "<Unknown>(" + mAGpsDataConnectionState + ")";
}
}
@@ -566,7 +583,7 @@
case GPS_REQUEST_AGPS_DATA_CONN:
return "REQUEST";
default:
- return "<Unknown>";
+ return "<Unknown>(" + agpsDataConnStatus + ")";
}
}
@@ -581,7 +598,7 @@
case AGPS_TYPE_IMS:
return "IMS";
default:
- return "<Unknown>";
+ return "<Unknown>(" + agpsType + ")";
}
}
@@ -658,4 +675,4 @@
private native void native_update_network_state(boolean connected, int type, boolean roaming,
boolean available, String apn, long networkHandle, short capabilities);
-}
\ No newline at end of file
+}
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
index d52ba16..9908b36 100644
--- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
+++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
@@ -2629,7 +2629,8 @@
0, null, new UserHandle(serviceUserId)));
if (!mContext.bindServiceAsUser(intent, newConn,
Context.BIND_AUTO_CREATE | Context.BIND_SHOWING_UI
- | Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE,
+ | Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE
+ | Context.BIND_INCLUDE_CAPABILITIES,
new UserHandle(serviceUserId))) {
String msg = "Unable to bind service: "
+ componentName;
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
index ad1e3ef..4d7ae73 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
@@ -1238,6 +1238,9 @@
RoleObserver(@NonNull @CallbackExecutor Executor executor) {
mRm.addOnRoleHoldersChangedListenerAsUser(executor, this, UserHandle.ALL);
+ UserHandle currentUser = UserHandle.of(LocalServices.getService(
+ ActivityManagerInternal.class).getCurrentUserId());
+ onRoleHoldersChanged(RoleManager.ROLE_ASSISTANT, currentUser);
}
private @NonNull String getDefaultRecognizer(@NonNull UserHandle user) {
@@ -1285,7 +1288,9 @@
// Try to set role holder as VoiceInteractionService
List<ResolveInfo> services = mPm.queryIntentServicesAsUser(
new Intent(VoiceInteractionService.SERVICE_INTERFACE).setPackage(pkg),
- PackageManager.GET_META_DATA, userId);
+ PackageManager.GET_META_DATA
+ | PackageManager.MATCH_DIRECT_BOOT_AWARE
+ | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, userId);
for (ResolveInfo resolveInfo : services) {
ServiceInfo serviceInfo = resolveInfo.serviceInfo;
@@ -1318,7 +1323,9 @@
// If no service could be found try to set assist activity
final List<ResolveInfo> activities = mPm.queryIntentActivitiesAsUser(
new Intent(Intent.ACTION_ASSIST).setPackage(pkg),
- PackageManager.MATCH_DEFAULT_ONLY, userId);
+ PackageManager.MATCH_DEFAULT_ONLY
+ | PackageManager.MATCH_DIRECT_BOOT_AWARE
+ | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, userId);
for (ResolveInfo resolveInfo : activities) {
ActivityInfo activityInfo = resolveInfo.activityInfo;
@@ -1331,6 +1338,7 @@
Settings.Secure.putStringForUser(getContext().getContentResolver(),
Settings.Secure.VOICE_RECOGNITION_SERVICE,
getDefaultRecognizer(user), userId);
+ return;
}
}
}
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
index 8d2cbca..ea52377 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
@@ -25,9 +25,6 @@
import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.ActivityTaskManager;
-
-import com.android.internal.app.IVoiceActionCheckCallback;
-import com.android.server.wm.ActivityTaskManagerInternal;
import android.app.IActivityManager;
import android.app.IActivityTaskManager;
import android.content.BroadcastReceiver;
@@ -51,15 +48,16 @@
import android.util.Slog;
import android.view.IWindowManager;
+import com.android.internal.app.IVoiceActionCheckCallback;
import com.android.internal.app.IVoiceInteractionSessionShowCallback;
import com.android.internal.app.IVoiceInteractor;
import com.android.server.LocalServices;
+import com.android.server.wm.ActivityTaskManagerInternal;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
-import java.util.Set;
class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConnection.Callback {
final static String TAG = "VoiceInteractionServiceManager";
@@ -358,6 +356,7 @@
intent.setComponent(mComponent);
mBound = mContext.bindServiceAsUser(intent, mConnection,
Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE
+ | Context.BIND_INCLUDE_CAPABILITIES
| Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS, new UserHandle(mUser));
if (!mBound) {
Slog.w(TAG, "Failed binding to voice interaction service " + mComponent);
diff --git a/telephony/java/android/telephony/CellSignalStrengthTdscdma.java b/telephony/java/android/telephony/CellSignalStrengthTdscdma.java
index ddbd851..b562f32 100644
--- a/telephony/java/android/telephony/CellSignalStrengthTdscdma.java
+++ b/telephony/java/android/telephony/CellSignalStrengthTdscdma.java
@@ -34,14 +34,14 @@
private static final String LOG_TAG = "CellSignalStrengthTdscdma";
private static final boolean DBG = false;
- private static final int TDSCDMA_RSSI_MAX = -51;
- private static final int TDSCDMA_RSSI_GREAT = -77;
- private static final int TDSCDMA_RSSI_GOOD = -87;
- private static final int TDSCDMA_RSSI_MODERATE = -97;
- private static final int TDSCDMA_RSSI_POOR = -107;
-
- private static final int TDSCDMA_RSCP_MIN = -120;
+ // These levels are arbitrary but carried over from SignalStrength.java for consistency.
private static final int TDSCDMA_RSCP_MAX = -24;
+ private static final int TDSCDMA_RSCP_GREAT = -49;
+ private static final int TDSCDMA_RSCP_GOOD = -73;
+ private static final int TDSCDMA_RSCP_MODERATE = -97;
+ private static final int TDSCDMA_RSCP_POOR = -110;
+ private static final int TDSCDMA_RSCP_MIN = -120;
+
private int mRssi; // in dBm [-113, -51], CellInfo.UNAVAILABLE
@@ -135,11 +135,11 @@
/** @hide */
@Override
public void updateLevel(PersistableBundle cc, ServiceState ss) {
- if (mRssi > TDSCDMA_RSSI_MAX) mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
- else if (mRssi >= TDSCDMA_RSSI_GREAT) mLevel = SIGNAL_STRENGTH_GREAT;
- else if (mRssi >= TDSCDMA_RSSI_GOOD) mLevel = SIGNAL_STRENGTH_GOOD;
- else if (mRssi >= TDSCDMA_RSSI_MODERATE) mLevel = SIGNAL_STRENGTH_MODERATE;
- else if (mRssi >= TDSCDMA_RSSI_POOR) mLevel = SIGNAL_STRENGTH_POOR;
+ if (mRscp > TDSCDMA_RSCP_MAX) mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
+ else if (mRscp >= TDSCDMA_RSCP_GREAT) mLevel = SIGNAL_STRENGTH_GREAT;
+ else if (mRscp >= TDSCDMA_RSCP_GOOD) mLevel = SIGNAL_STRENGTH_GOOD;
+ else if (mRscp >= TDSCDMA_RSCP_MODERATE) mLevel = SIGNAL_STRENGTH_MODERATE;
+ else if (mRscp >= TDSCDMA_RSCP_POOR) mLevel = SIGNAL_STRENGTH_POOR;
else mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
}
@@ -159,6 +159,23 @@
}
/**
+ * Get the RSSI as dBm value -113..-51dBm or {@link CellInfo#UNAVAILABLE UNAVAILABLE}.
+ *
+ * @hide
+ */
+ public int getRssi() {
+ return mRssi;
+ }
+
+ /**
+ * Get the BER as an ASU value 0..7, 99, or {@link CellInfo#UNAVAILABLE UNAVAILABLE}.
+ * @hide
+ */
+ public int getBitErrorRate() {
+ return mBitErrorRate;
+ }
+
+ /**
* Get the RSCP in ASU.
*
* Asu is calculated based on 3GPP RSRP. Refer to 3GPP 27.007 (Ver 10.3.0) Sec 8.69
diff --git a/telephony/java/android/telephony/CellSignalStrengthWcdma.java b/telephony/java/android/telephony/CellSignalStrengthWcdma.java
index d9fd7f3..8efc0f2 100644
--- a/telephony/java/android/telephony/CellSignalStrengthWcdma.java
+++ b/telephony/java/android/telephony/CellSignalStrengthWcdma.java
@@ -66,7 +66,7 @@
public static final String LEVEL_CALCULATION_METHOD_RSCP = "rscp";
// Default to RSSI for backwards compatibility with older devices
- private static final String sLevelCalculationMethod = LEVEL_CALCULATION_METHOD_RSSI;
+ private static final String DEFAULT_LEVEL_CALCULATION_METHOD = LEVEL_CALCULATION_METHOD_RSSI;
private int mRssi; // in dBm [-113, 51] or CellInfo.UNAVAILABLE if unknown
private int mBitErrorRate; // bit error rate (0-7, 99) as defined in TS 27.007 8.5 or
@@ -161,14 +161,14 @@
int[] rscpThresholds;
if (cc == null) {
- calcMethod = sLevelCalculationMethod;
+ calcMethod = DEFAULT_LEVEL_CALCULATION_METHOD;
rscpThresholds = sRscpThresholds;
} else {
// TODO: abstract this entire thing into a series of functions
calcMethod = cc.getString(
CarrierConfigManager.KEY_WCDMA_DEFAULT_SIGNAL_STRENGTH_MEASUREMENT_STRING,
- sLevelCalculationMethod);
- if (TextUtils.isEmpty(calcMethod)) calcMethod = sLevelCalculationMethod;
+ DEFAULT_LEVEL_CALCULATION_METHOD);
+ if (TextUtils.isEmpty(calcMethod)) calcMethod = DEFAULT_LEVEL_CALCULATION_METHOD;
rscpThresholds = cc.getIntArray(
CarrierConfigManager.KEY_WCDMA_RSCP_THRESHOLDS_INT_ARRAY);
if (rscpThresholds == null || rscpThresholds.length != NUM_SIGNAL_STRENGTH_THRESHOLDS) {
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index a933da7..57c84a6 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -2749,6 +2749,8 @@
*
* @throws SecurityException if the caller doesn't meet the requirements
* outlined above.
+ * @throws IllegalArgumentException if any of the subscriptions in the list doesn't exist.
+ * @throws IllegalStateException if Telephony service is in bad state.
*
* @param subIdList list of subId that will be in the same group
* @return groupUUID a UUID assigned to the subscription group.
@@ -2797,6 +2799,7 @@
* outlined above.
* @throws IllegalArgumentException if the some subscriptions in the list doesn't exist,
* or the groupUuid doesn't exist.
+ * @throws IllegalStateException if Telephony service is in bad state.
*
* @param subIdList list of subId that need adding into the group
* @param groupUuid the groupUuid the subscriptions are being added to.
@@ -2849,6 +2852,7 @@
* outlined above.
* @throws IllegalArgumentException if the some subscriptions in the list doesn't belong
* the specified group.
+ * @throws IllegalStateException if Telephony service is in bad state.
*
* @param subIdList list of subId that need removing from their groups.
*