diff options
15 files changed, 72 insertions, 84 deletions
diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java index 591e8ba859fc..4becc6b7c44a 100644 --- a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +++ b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java @@ -1008,13 +1008,21 @@ public class JobSchedulerService extends com.android.server.SystemService } @Override - public void onUserUnlocked(@NonNull TargetUser user) { + public void onUserStarting(@NonNull TargetUser user) { synchronized (mLock) { - // Note that the user has started after its unlocked instead of when the user - // actually starts because the storage won't be decrypted until unlock. mStartedUsers = ArrayUtils.appendInt(mStartedUsers, user.getUserIdentifier()); } - // Let's kick any outstanding jobs for this user. + // The user is starting but credential encrypted storage is still locked. + // Only direct-boot-aware jobs can safely run. + // Let's kick off any eligible jobs for this user. + mHandler.obtainMessage(MSG_CHECK_JOB).sendToTarget(); + } + + @Override + public void onUserUnlocked(@NonNull TargetUser user) { + // The user is fully unlocked and credential encrypted storage is now decrypted. + // Direct-boot-UNaware jobs can now safely run. + // Let's kick off any outstanding jobs for this user. mHandler.obtainMessage(MSG_CHECK_JOB).sendToTarget(); } diff --git a/core/java/android/net/OWNERS b/core/java/android/net/OWNERS index 24a06dfc8b97..f55bcd31feb7 100644 --- a/core/java/android/net/OWNERS +++ b/core/java/android/net/OWNERS @@ -2,5 +2,5 @@ set noparent include platform/frameworks/base:/services/core/java/com/android/server/net/OWNERS -per-file SSL*, Uri*, Url* = prb@google.com, dauletz@google.com, narayan@google.com, ngeoffray@google.com -per-file SntpClient*, sntp/* = file:/services/core/java/com/android/server/timedetector/OWNERS +per-file SSL*,Uri*,Url* = prb@google.com,oth@google.com,narayan@google.com,ngeoffray@google.com +per-file SntpClient* = file:/services/core/java/com/android/server/timedetector/OWNERS diff --git a/core/java/android/net/sntp/OWNERS b/core/java/android/net/sntp/OWNERS new file mode 100644 index 000000000000..9a3e264a067f --- /dev/null +++ b/core/java/android/net/sntp/OWNERS @@ -0,0 +1 @@ +include /services/core/java/com/android/server/timedetector/OWNERS diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java index fa578be0c984..ab2c8c0e31d3 100644 --- a/core/java/android/os/Parcel.java +++ b/core/java/android/os/Parcel.java @@ -401,7 +401,7 @@ public final class Parcel { private static final int WRITE_EXCEPTION_STACK_TRACE_THRESHOLD_MS = 1000; @CriticalNative - private static native long nativeGetBlobAshmemSize(long nativePtr); + private static native long nativeGetOpenAshmemSize(long nativePtr); public final static Parcelable.Creator<String> STRING_CREATOR = new Parcelable.Creator<String>() { @@ -2891,9 +2891,11 @@ public final class Parcel { /** * Same as {@link #readList(List, ClassLoader)} but accepts {@code clazz} parameter as - * the type required for each item. If the item to be deserialized is not an instance - * of that class or any of its children class - * a {@link BadParcelableException} will be thrown. + * the type required for each item. + * + * @throws BadParcelableException Throws BadParcelableException if the item to be deserialized + * is not an instance of that class or any of its children classes or there was an error + * trying to instantiate an element. */ public <T> void readList(@NonNull List<? super T> outVal, @Nullable ClassLoader loader, @NonNull Class<T> clazz) { @@ -3894,8 +3896,11 @@ public final class Parcel { /** * Same as {@link #readParcelable(ClassLoader)} but accepts {@code clazz} parameter as the type - * required for each item. If the item to be deserialized is not an instance of that class or - * any of its children classes a {@link BadParcelableException} will be thrown. + * required for each item. + * + * @throws BadParcelableException Throws BadParcelableException if the item to be deserialized + * is not an instance of that class or any of its children classes or there was an error + * trying to instantiate an element. */ @Nullable public <T extends Parcelable> T readParcelable(@Nullable ClassLoader loader, @@ -3961,8 +3966,11 @@ public final class Parcel { /** * Same as {@link #readParcelableCreator(ClassLoader)} but accepts {@code clazz} parameter - * as the required type. If the item to be deserialized is not an instance of that class - * or any of its children classes a {@link BadParcelableException} will be thrown. + * as the required type. + * + * @throws BadParcelableException Throws BadParcelableException if the item to be deserialized + * is not an instance of that class or any of its children class or there there was an error + * trying to read the {@link Parcelable.Creator}. */ @Nullable public <T> Parcelable.Creator<T> readParcelableCreator( @@ -4373,8 +4381,8 @@ public final class Parcel { /** * @hide For testing */ - public long getBlobAshmemSize() { - return nativeGetBlobAshmemSize(mNativePtr); + public long getOpenAshmemSize() { + return nativeGetOpenAshmemSize(mNativePtr); } private static String valueTypeToString(int type) { diff --git a/core/jni/android_os_Parcel.cpp b/core/jni/android_os_Parcel.cpp index 8fee610180ca..0d338072fa00 100644 --- a/core/jni/android_os_Parcel.cpp +++ b/core/jni/android_os_Parcel.cpp @@ -740,11 +740,11 @@ static jlong android_os_Parcel_getGlobalAllocCount(JNIEnv* env, jclass clazz) return Parcel::getGlobalAllocCount(); } -static jlong android_os_Parcel_getBlobAshmemSize(jlong nativePtr) +static jlong android_os_Parcel_getOpenAshmemSize(jlong nativePtr) { Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr); if (parcel != NULL) { - return parcel->getBlobAshmemSize(); + return parcel->getOpenAshmemSize(); } return 0; } @@ -852,7 +852,7 @@ static const JNINativeMethod gParcelMethods[] = { {"getGlobalAllocCount", "()J", (void*)android_os_Parcel_getGlobalAllocCount}, // @CriticalNative - {"nativeGetBlobAshmemSize", "(J)J", (void*)android_os_Parcel_getBlobAshmemSize}, + {"nativeGetOpenAshmemSize", "(J)J", (void*)android_os_Parcel_getOpenAshmemSize}, // @CriticalNative {"nativeReadCallingWorkSourceUid", "(J)I", (void*)android_os_Parcel_readCallingWorkSourceUid}, diff --git a/core/tests/coretests/src/android/net/OWNERS b/core/tests/coretests/src/android/net/OWNERS index aa87958f1d53..4e5136f93b94 100644 --- a/core/tests/coretests/src/android/net/OWNERS +++ b/core/tests/coretests/src/android/net/OWNERS @@ -1 +1,3 @@ include /services/core/java/com/android/server/net/OWNERS + +per-file SntpClient* = file:/services/core/java/com/android/server/timedetector/OWNERS diff --git a/core/tests/coretests/src/android/net/sntp/OWNERS b/core/tests/coretests/src/android/net/sntp/OWNERS new file mode 100644 index 000000000000..232c2ebe75e0 --- /dev/null +++ b/core/tests/coretests/src/android/net/sntp/OWNERS @@ -0,0 +1 @@ +include /core/java/android/net/sntp/OWNERS diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java index 83ed2c602220..58d2185ea9e9 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java @@ -130,9 +130,6 @@ public class BluetoothEventManager { addHandler(BluetoothDevice.ACTION_ACL_CONNECTED, new AclStateChangedHandler()); addHandler(BluetoothDevice.ACTION_ACL_DISCONNECTED, new AclStateChangedHandler()); - addHandler(BluetoothCsipSetCoordinator.ACTION_CSIS_SET_MEMBER_AVAILABLE, - new SetMemberAvailableHandler()); - registerAdapterIntentReceiver(); } @@ -521,29 +518,4 @@ public class BluetoothEventManager { dispatchAudioModeChanged(); } } - - private class SetMemberAvailableHandler implements Handler { - @Override - public void onReceive(Context context, Intent intent, BluetoothDevice device) { - final String action = intent.getAction(); - if (device == null) { - Log.e(TAG, "SetMemberAvailableHandler: device is null"); - return; - } - - if (action == null) { - Log.e(TAG, "SetMemberAvailableHandler: action is null"); - return; - } - - final int groupId = intent.getIntExtra(BluetoothCsipSetCoordinator.EXTRA_CSIS_GROUP_ID, - BluetoothCsipSetCoordinator.GROUP_ID_INVALID); - if (groupId == BluetoothCsipSetCoordinator.GROUP_ID_INVALID) { - Log.e(TAG, "SetMemberAvailableHandler: Invalid group id"); - return; - } - - mDeviceManager.onSetMemberAppear(device, groupId); - } - } } diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceManager.java index 1f75ae329f4a..b429fe6d4939 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceManager.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceManager.java @@ -340,22 +340,24 @@ public class CachedBluetoothDeviceManager { /** * Called when we found a set member of a group. The function will check the {@code groupId} if - * it exists and if there is a ongoing pair, the device would be ignored. + * it exists and the bond state of the device is BOND_NOE, and if there isn't any ongoing pair + * , and then return {@code true} to pair the device automatically. * * @param device The found device * @param groupId The group id of the found device + * + * @return {@code true}, if the device should pair automatically; Otherwise, return + * {@code false}. */ - public synchronized void onSetMemberAppear(BluetoothDevice device, int groupId) { - Log.d(TAG, "onSetMemberAppear, groupId: " + groupId + " device: " + device.toString()); - - if (mOngoingSetMemberPair != null) { - Log.d(TAG, "Ongoing set memberPairing in process, drop it!"); - return; + public synchronized boolean shouldPairByCsip(BluetoothDevice device, int groupId) { + if (mOngoingSetMemberPair != null || device.getBondState() != BluetoothDevice.BOND_NONE + || !mCsipDeviceManager.isExistedGroupId(groupId)) { + return false; } - if (mCsipDeviceManager.onSetMemberAppear(device, groupId)) { - mOngoingSetMemberPair = device; - } + Log.d(TAG, "Bond " + device.getName() + " by CSIP"); + mOngoingSetMemberPair = device; + return true; } /** diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CsipDeviceManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CsipDeviceManager.java index 347e14b91656..1d29966838d3 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CsipDeviceManager.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CsipDeviceManager.java @@ -240,22 +240,15 @@ public class CsipDeviceManager { } /** - * Called when we found a set member of a group. The function will check bond state, and - * the {@code groupId} if it exists, and then create the bond. + * Check if the {@code groupId} is existed. * - * @param device The found device - * @param groupId The group id of the found device + * @param groupId The group id * - * @return {@code true}, if the we create bond with the device. Otherwise, return - * {@code false}. + * @return {@code true}, if we could find a device with this {@code groupId}; Otherwise, + * return {@code false}. */ - public boolean onSetMemberAppear(BluetoothDevice device, int groupId) { - if (device.getBondState() != BluetoothDevice.BOND_NONE) { - return false; - } - + public boolean isExistedGroupId(int groupId) { if (getCachedDevice(groupId) != null) { - device.createBond(BluetoothDevice.TRANSPORT_LE); return true; } diff --git a/services/core/java/com/android/server/BootReceiver.java b/services/core/java/com/android/server/BootReceiver.java index fdba098e6b80..469f465d7c9a 100644 --- a/services/core/java/com/android/server/BootReceiver.java +++ b/services/core/java/com/android/server/BootReceiver.java @@ -476,7 +476,11 @@ public class BootReceiver extends BroadcastReceiver { */ public static void addTombstoneToDropBox(Context ctx, File tombstone, boolean proto) { final DropBoxManager db = ctx.getSystemService(DropBoxManager.class); - final String bootReason = SystemProperties.get("ro.boot.bootreason", null); + if (db == null) { + Slog.e(TAG, "Can't log tombstone: DropBoxManager not available"); + return; + } + HashMap<String, Long> timestamps = readTimestamps(); try { if (proto) { diff --git a/services/core/java/com/android/server/pm/dex/OWNERS b/services/core/java/com/android/server/pm/dex/OWNERS index 5a4431ee8c89..052a4ca52afd 100644 --- a/services/core/java/com/android/server/pm/dex/OWNERS +++ b/services/core/java/com/android/server/pm/dex/OWNERS @@ -1,2 +1,3 @@ -calin@google.com +alanstokes@google.com +jiakaiz@google.com ngeoffray@google.com diff --git a/services/core/jni/com_android_server_power_PowerManagerService.cpp b/services/core/jni/com_android_server_power_PowerManagerService.cpp index 7fea547459bc..fe86ff1ef7ef 100644 --- a/services/core/jni/com_android_server_power_PowerManagerService.cpp +++ b/services/core/jni/com_android_server_power_PowerManagerService.cpp @@ -178,9 +178,10 @@ sp<system::suspend::internal::ISuspendControlServiceInternal> getSuspendControlI void enableAutoSuspend() { static bool enabled = false; if (!enabled) { + static sp<IBinder> autosuspendClientToken = new BBinder(); sp<system::suspend::internal::ISuspendControlServiceInternal> suspendControl = getSuspendControlInternal(); - suspendControl->enableAutosuspend(&enabled); + suspendControl->enableAutosuspend(autosuspendClientToken, &enabled); } { diff --git a/startop/OWNERS b/startop/OWNERS index 2d1eb38952ed..11d5ad0f000a 100644 --- a/startop/OWNERS +++ b/startop/OWNERS @@ -1,7 +1,2 @@ -# mailing list: startop-eng@google.com -calin@google.com -chriswailes@google.com -eholk@google.com -iam@google.com -mathieuc@google.com -yawanng@google.com +include platform/art:/OWNERS +keunyoung@google.com diff --git a/tests/notification/src/com/android/frameworks/tests/notification/NotificationTests.java b/tests/notification/src/com/android/frameworks/tests/notification/NotificationTests.java index 7cda977d2115..5d639f6f6266 100644 --- a/tests/notification/src/com/android/frameworks/tests/notification/NotificationTests.java +++ b/tests/notification/src/com/android/frameworks/tests/notification/NotificationTests.java @@ -409,10 +409,10 @@ public class NotificationTests extends AndroidTestCase { sleepIfYouCan(500); L("Parceling notifications..."); - // we want to be able to use this test on older OSes that do not have getBlobAshmemSize - Method getBlobAshmemSize = null; + // we want to be able to use this test on older OSes that do not have getOpenAshmemSize + Method getOpenAshmemSize = null; try { - getBlobAshmemSize = Parcel.class.getMethod("getBlobAshmemSize"); + getOpenAshmemSize = Parcel.class.getMethod("getOpenAshmemSize"); } catch (NoSuchMethodException ex) { } for (int i=0; i<mNotifications.size(); i++) { @@ -424,8 +424,8 @@ public class NotificationTests extends AndroidTestCase { time = SystemClock.currentThreadTimeMillis() - time; L(" %s: write parcel=%dms size=%d ashmem=%s", summarize(n), time, p.dataPosition(), - (getBlobAshmemSize != null) - ? getBlobAshmemSize.invoke(p) + (getOpenAshmemSize != null) + ? getOpenAshmemSize.invoke(p) : "???"); p.setDataPosition(0); } |