Skip to content

Commit ff6d2d5

Browse files
author
Genkzsz11
committed
Merge tag 'android-11.0.0_r38' of https://android.googlesource.com/platform/frameworks/base into 11
Android 11.0.0 Release 38 (RQ3A.210605.005) Signed-off-by: Genkzsz11 <Genkzsz11@gmail.com>
2 parents 6590ce2 + ba595d5 commit ff6d2d5

434 files changed

Lines changed: 5049 additions & 3213 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cmds/statsd/src/atoms.proto

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3612,11 +3612,11 @@ message AppStartOccurred {
36123612
// Empty if not set.
36133613
optional string launch_token = 13;
36143614

3615-
// The compiler filter used when when the package was optimized.
3616-
optional int32 package_optimization_compilation_filter = 14;
3617-
36183615
// The reason why the package was optimized.
3619-
optional int32 package_optimization_compilation_reason = 15;
3616+
optional int32 package_optimization_compilation_reason = 14;
3617+
3618+
// The compiler filter used when when the package was optimized.
3619+
optional int32 package_optimization_compilation_filter = 15;
36203620
}
36213621

36223622
message AppStartCanceled {
@@ -3662,11 +3662,11 @@ message AppStartFullyDrawn {
36623662
// App startup time (until call to Activity#reportFullyDrawn()).
36633663
optional int64 app_startup_time_millis = 6;
36643664

3665-
// The compiler filter used when when the package was optimized.
3666-
optional int32 package_optimization_compilation_filter = 7;
3667-
36683665
// The reason why the package was optimized.
3669-
optional int32 package_optimization_compilation_reason = 8;
3666+
optional int32 package_optimization_compilation_reason = 7;
3667+
3668+
// The compiler filter used when when the package was optimized.
3669+
optional int32 package_optimization_compilation_filter = 8;
36703670
}
36713671

36723672
/**

core/java/android/app/Activity.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5183,12 +5183,6 @@ protected void onApplyThemeResource(Resources.Theme theme, @StyleRes int resid,
51835183
* #checkSelfPermission(String)}.
51845184
* </p>
51855185
* <p>
5186-
* Calling this API for permissions already granted to your app would show UI
5187-
* to the user to decide whether the app can still hold these permissions. This
5188-
* can be useful if the way your app uses data guarded by the permissions
5189-
* changes significantly.
5190-
* </p>
5191-
* <p>
51925186
* You cannot request a permission if your activity sets {@link
51935187
* android.R.styleable#AndroidManifestActivity_noHistory noHistory} to
51945188
* <code>true</code> because in this case the activity would not receive

core/java/android/app/ActivityManagerInternal.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,21 @@ public abstract void setDebugFlagsForStartingActivity(ActivityInfo aInfo, int st
377377
*/
378378
public abstract boolean hasRunningForegroundService(int uid, int foregroundServiceType);
379379

380+
/**
381+
* Returns {@code true} if the given notification channel currently has a
382+
* notification associated with a foreground service. This is an AMS check
383+
* because that is the source of truth for the FGS state.
384+
*/
385+
public abstract boolean hasForegroundServiceNotification(String pkg, @UserIdInt int userId,
386+
String channelId);
387+
388+
/**
389+
* If the given app has any FGSs whose notifications are in the given channel,
390+
* stop them.
391+
*/
392+
public abstract void stopForegroundServicesForChannel(String pkg, @UserIdInt int userId,
393+
String channelId);
394+
380395
/**
381396
* Registers the specified {@code processObserver} to be notified of future changes to
382397
* process state.
@@ -440,4 +455,11 @@ public abstract int broadcastIntent(Intent intent,
440455
* @return true if exists, false otherwise.
441456
*/
442457
public abstract boolean isPendingTopUid(int uid);
458+
459+
public abstract void tempAllowWhileInUsePermissionInFgs(int uid, long duration);
460+
461+
public abstract boolean isTempAllowlistedForFgsWhileInUse(int uid);
462+
463+
public abstract boolean canAllowWhileInUsePermissionInFgs(int pid, int uid,
464+
@NonNull String packageName);
443465
}

core/java/android/app/ActivityThread.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4602,6 +4602,10 @@ public void handleTopResumedActivityChanged(IBinder token, boolean onTop, String
46024602
}
46034603

46044604
if (r.isTopResumedActivity == onTop) {
4605+
if (!Build.IS_DEBUGGABLE) {
4606+
Slog.w(TAG, "Activity top position already set to onTop=" + onTop);
4607+
return;
4608+
}
46054609
throw new IllegalStateException("Activity top position already set to onTop=" + onTop);
46064610
}
46074611

core/java/android/app/AppOpsManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2436,9 +2436,9 @@ public static String flagsToString(@OpFlags int flags) {
24362436
false, // READ_MEDIA_AUDIO
24372437
false, // WRITE_MEDIA_AUDIO
24382438
false, // READ_MEDIA_VIDEO
2439-
false, // WRITE_MEDIA_VIDEO
2439+
true, // WRITE_MEDIA_VIDEO
24402440
false, // READ_MEDIA_IMAGES
2441-
false, // WRITE_MEDIA_IMAGES
2441+
true, // WRITE_MEDIA_IMAGES
24422442
true, // LEGACY_STORAGE
24432443
false, // ACCESS_ACCESSIBILITY
24442444
false, // READ_DEVICE_IDENTIFIERS

core/java/android/app/admin/DevicePolicyManagerInternal.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package android.app.admin;
1818

19+
import android.annotation.Nullable;
1920
import android.annotation.UserIdInt;
2021
import android.content.ComponentName;
2122
import android.content.Intent;
@@ -221,6 +222,7 @@ public abstract void broadcastIntentToCrossProfileManifestReceiversAsUser(Intent
221222
/**
222223
* Returns the profile owner component for the given user, or {@code null} if there is not one.
223224
*/
225+
@Nullable
224226
public abstract ComponentName getProfileOwnerAsUser(int userHandle);
225227

226228
/**
@@ -234,4 +236,9 @@ public abstract void broadcastIntentToCrossProfileManifestReceiversAsUser(Intent
234236
* {@link #supportsResetOp(int)} is true.
235237
*/
236238
public abstract void resetOp(int op, String packageName, @UserIdInt int userId);
239+
240+
/**
241+
* Returns whether the given package is a device owner or a profile owner in the calling user.
242+
*/
243+
public abstract boolean isDeviceOrProfileOwnerInCallingUser(String packageName);
237244
}

core/java/android/app/backup/BackupManager.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@
2121
import android.annotation.RequiresPermission;
2222
import android.annotation.SystemApi;
2323
import android.annotation.TestApi;
24+
import android.app.compat.CompatChanges;
25+
import android.compat.annotation.ChangeId;
26+
import android.compat.annotation.EnabledAfter;
2427
import android.compat.annotation.UnsupportedAppUsage;
2528
import android.content.ComponentName;
2629
import android.content.Context;
2730
import android.content.Intent;
31+
import android.os.Build;
2832
import android.os.Bundle;
2933
import android.os.Handler;
3034
import android.os.Message;
@@ -391,6 +395,17 @@ public boolean isBackupEnabled() {
391395
return false;
392396
}
393397

398+
399+
/**
400+
* If this change is enabled, the {@code BACKUP} permission needed for
401+
* {@code isBackupServiceActive()} will be enforced on the service end
402+
* rather than client-side in {@link BackupManager}.
403+
* @hide
404+
*/
405+
@ChangeId
406+
@EnabledAfter(targetSdkVersion = Build.VERSION_CODES.R)
407+
public static final long IS_BACKUP_SERVICE_ACTIVE_ENFORCE_PERMISSION_IN_SERVICE = 158482162;
408+
394409
/**
395410
* Report whether the backup mechanism is currently active.
396411
* When it is inactive, the device will not perform any backup operations, nor will it
@@ -401,8 +416,11 @@ public boolean isBackupEnabled() {
401416
@SystemApi
402417
@RequiresPermission(android.Manifest.permission.BACKUP)
403418
public boolean isBackupServiceActive(UserHandle user) {
404-
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP,
405-
"isBackupServiceActive");
419+
if (!CompatChanges.isChangeEnabled(
420+
IS_BACKUP_SERVICE_ACTIVE_ENFORCE_PERMISSION_IN_SERVICE)) {
421+
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP,
422+
"isBackupServiceActive");
423+
}
406424
checkServiceBinder();
407425
if (sService != null) {
408426
try {

core/java/android/content/pm/parsing/ParsingPackageImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
9898
public static ForInternedStringValueMap sForInternedStringValueMap =
9999
Parcelling.Cache.getOrCreate(ForInternedStringValueMap.class);
100100
public static ForStringSet sForStringSet = Parcelling.Cache.getOrCreate(ForStringSet.class);
101+
public static ForInternedStringSet sForInternedStringSet =
102+
Parcelling.Cache.getOrCreate(ForInternedStringSet.class);
101103
protected static ParsedIntentInfo.StringPairListParceler sForIntentInfoPairs =
102104
Parcelling.Cache.getOrCreate(ParsedIntentInfo.StringPairListParceler.class);
103105

@@ -1026,6 +1028,7 @@ public void writeToParcel(Parcel dest, int flags) {
10261028
dest.writeBoolean(this.forceQueryable);
10271029
dest.writeParcelableList(this.queriesIntents, flags);
10281030
sForInternedStringList.parcel(this.queriesPackages, dest, flags);
1031+
sForInternedStringSet.parcel(this.queriesProviders, dest, flags);
10291032
dest.writeString(this.appComponentFactory);
10301033
dest.writeString(this.backupAgentName);
10311034
dest.writeInt(this.banner);
@@ -1188,6 +1191,7 @@ public ParsingPackageImpl(Parcel in) {
11881191
this.forceQueryable = in.readBoolean();
11891192
this.queriesIntents = in.createTypedArrayList(Intent.CREATOR);
11901193
this.queriesPackages = sForInternedStringList.unparcel(in);
1194+
this.queriesProviders = sForInternedStringSet.unparcel(in);
11911195
this.appComponentFactory = in.readString();
11921196
this.backupAgentName = in.readString();
11931197
this.banner = in.readInt();

core/java/android/hardware/camera2/CameraManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,6 +1369,8 @@ public void onCameraClosed(String id) {
13691369
// devices going offline (in real world scenarios, these permissions aren't
13701370
// changeable). Future calls to getCameraIdList() will reflect the changes in
13711371
// the camera id list after getCameraIdListNoLazy() is called.
1372+
// We need to remove the torch ids which may have been associated with the
1373+
// devices removed as well. This is the same situation.
13721374
cameraStatuses = mCameraService.addListener(testListener);
13731375
mCameraService.removeListener(testListener);
13741376
for (CameraStatus c : cameraStatuses) {
@@ -1387,6 +1389,7 @@ public void onCameraClosed(String id) {
13871389
}
13881390
for (String id : deviceIdsToRemove) {
13891391
onStatusChangedLocked(ICameraServiceListener.STATUS_NOT_PRESENT, id);
1392+
mTorchStatus.remove(id);
13901393
}
13911394
} catch (ServiceSpecificException e) {
13921395
// Unexpected failure

core/java/android/hardware/display/DisplayManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ public final class DisplayManager {
6161
* {@link #EXTRA_WIFI_DISPLAY_STATUS} extra.
6262
* </p><p>
6363
* This broadcast is only sent to registered receivers and can only be sent by the system.
64+
* </p><p>
65+
* {@link android.Manifest.permission#ACCESS_FINE_LOCATION} permission is required to
66+
* receive this broadcast.
6467
* </p>
6568
* @hide
6669
*/

0 commit comments

Comments
 (0)