Skip to content

Commit

Permalink
Merge tag 'android-11.0.0_r20' of https://android.googlesource.com/pl…
Browse files Browse the repository at this point in the history
…atform//frameworks/base into HEAD

Android 11.0.0 Release 20 (RQ1A.201205.010)

Change-Id: I56e5f0bf97e0549ae54daa4cb8fd876e1e5596aa
  • Loading branch information
TheRingMaster committed Dec 13, 2020
2 parents 5e42784 + e0b64f1 commit 2aa6ed1
Show file tree
Hide file tree
Showing 1,097 changed files with 24,810 additions and 9,909 deletions.
40 changes: 40 additions & 0 deletions Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -1227,3 +1227,43 @@ build = [
"StubLibraries.bp",
"ApiDocs.bp",
]

java_library {
name: "framework-telephony",
srcs: [
//":framework-telephony-sources",
//":framework-telephony-shared-srcs",
],
// TODO: change to framework-system-stub to build against system APIs.
libs: [
"framework-minus-apex",
"unsupportedappusage",
],
static_libs: [
"libphonenumber-platform",
"app-compat-annotations",
],
sdk_version: "core_platform",
aidl: {
export_include_dirs: ["telephony/java"],
include_dirs: [
"frameworks/native/aidl/binder",
"frameworks/native/aidl/gui",
]
},
jarjar_rules: ":framework-telephony-jarjar-rules",
dxflags: [
"--core-library",
"--multi-dex",
],
// This is to break the dependency from boot jars.
dex_preopt: {
enabled: false,
},
installable: true,
}

filegroup {
name: "framework-telephony-jarjar-rules",
srcs: ["telephony/framework-telephony-jarjar-rules.txt"],
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public static class DeviceConfigProperties {
*/
public static final String KEY_USE_REVOCABLE_FD_FOR_READS =
"use_revocable_fd_for_reads";
public static final boolean DEFAULT_USE_REVOCABLE_FD_FOR_READS = true;
public static final boolean DEFAULT_USE_REVOCABLE_FD_FOR_READS = false;
public static boolean USE_REVOCABLE_FD_FOR_READS =
DEFAULT_USE_REVOCABLE_FD_FOR_READS;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,6 @@ public void onBootPhase(int phase) {

mSystemServicesReady = true;

// Offload to handler thread to avoid boot time impact.
mHandler.post(AppStandbyController.this::updatePowerWhitelistCache);

boolean userFileExists;
synchronized (mAppIdleLock) {
userFileExists = mAppIdleHistory.userFileExists(UserHandle.USER_SYSTEM);
Expand All @@ -474,7 +471,9 @@ public void onBootPhase(int phase) {
setChargingState(mInjector.isCharging());

// Offload to handler thread after boot completed to avoid boot time impact. This means
// that headless system apps may be put in a lower bucket until boot has completed.
// that app standby buckets may be slightly out of date and headless system apps may be
// put in a lower bucket until boot has completed.
mHandler.post(AppStandbyController.this::updatePowerWhitelistCache);
mHandler.post(this::loadHeadlessSystemAppCache);
}
}
Expand Down Expand Up @@ -1121,6 +1120,10 @@ private int getAppMinBucket(String packageName, int appId, int userId) {
if (isDeviceProvisioningPackage(packageName)) {
return STANDBY_BUCKET_EXEMPTED;
}

if (mInjector.isWellbeingPackage(packageName)) {
return STANDBY_BUCKET_WORKING_SET;
}
}

// Check this last, as it can be the most expensive check
Expand Down Expand Up @@ -1930,6 +1933,7 @@ static class Injector {
*/
@GuardedBy("mPowerWhitelistedApps")
private final ArraySet<String> mPowerWhitelistedApps = new ArraySet<>();
private String mWellbeingApp = null;

Injector(Context context, Looper looper) {
mContext = context;
Expand Down Expand Up @@ -1963,6 +1967,9 @@ void onBootPhase(int phase) {
if (activityManager.isLowRamDevice() || ActivityManager.isSmallBatteryDevice()) {
mAutoRestrictedBucketDelayMs = 12 * ONE_HOUR;
}

final PackageManager packageManager = mContext.getPackageManager();
mWellbeingApp = packageManager.getWellbeingPackageName();
}
mBootPhase = phase;
}
Expand Down Expand Up @@ -2007,6 +2014,14 @@ boolean isNonIdleWhitelisted(String packageName) {
}
}

/**
* Returns {@code true} if the supplied package is the wellbeing app. Otherwise,
* returns {@code false}.
*/
boolean isWellbeingPackage(String packageName) {
return mWellbeingApp != null && mWellbeingApp.equals(packageName);
}

void updatePowerWhitelistCache() {
try {
// Don't call out to DeviceIdleController with the lock held.
Expand Down
1 change: 1 addition & 0 deletions api/test-current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ package android {
public static final class R.bool {
field public static final int config_assistantOnTopOfDream = 17891333; // 0x1110005
field public static final int config_perDisplayFocusEnabled = 17891332; // 0x1110004
field public static final int config_remoteInsetsControllerControlsSystemBars = 17891334; // 0x1110006
}

public static final class R.string {
Expand Down
4 changes: 4 additions & 0 deletions cmds/incidentd/src/IncidentService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,10 @@ status_t IncidentService::command(FILE* in, FILE* out, FILE* err, Vector<String8
return NO_ERROR;
}
if (!args[0].compare(String8("section"))) {
if (argCount == 1) {
fprintf(out, "Not enough arguments for section\n");
return NO_ERROR;
}
int id = atoi(args[1]);
int idx = 0;
while (SECTION_LIST[idx] != NULL) {
Expand Down
25 changes: 21 additions & 4 deletions cmds/statsd/src/atoms.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3863,6 +3863,17 @@ message LmkStateChanged {
* system/core/lmkd/lmkd.c
*/
message LmkKillOccurred {
enum Reason {
UNKNOWN = 0;
PRESSURE_AFTER_KILL = 1;
NOT_RESPONDING = 2;
LOW_SWAP_AND_THRASHING = 3;
LOW_MEM_AND_SWAP = 4;
LOW_MEM_AND_THRASHING = 5;
DIRECT_RECL_AND_THRASHING = 6;
LOW_MEM_AND_SWAP_UTIL = 7;
}

// The uid if available. -1 means not available.
optional int32 uid = 1 [(is_uid) = true];

Expand Down Expand Up @@ -3892,6 +3903,15 @@ message LmkKillOccurred {

// Min oom adj score considered by lmkd.
optional int32 min_oom_score = 10;

// Free physical memory on device at LMK time.
optional int32 free_mem_kb = 11;

// Free swap on device at LMK time.
optional int32 free_swap_kb = 12;

// What triggered the LMK event.
optional Reason reason = 13;
}

/*
Expand Down Expand Up @@ -4420,15 +4440,12 @@ message PrivacyIndicatorsInteracted {
UNKNOWN = 0;
CHIP_VIEWED = 1;
CHIP_CLICKED = 2;
DIALOG_PRIVACY_SETTINGS = 3;
reserved 3; // Used only in beta builds, never shipped
DIALOG_DISMISS = 4;
DIALOG_LINE_ITEM = 5;
}

optional Type type = 1 [(state_field_option).exclusive_state = true];

// Used if the type is LINE_ITEM
optional string package_name = 2;
}

/**
Expand Down
1 change: 1 addition & 0 deletions cmds/uiautomator/library/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ java_library_static {
"android.test.runner",
"junit",
],
java_version: "1.8",
}

java_library_static {
Expand Down
100 changes: 52 additions & 48 deletions core/java/android/app/ActivityThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -3250,12 +3250,6 @@ final void scheduleContextCleanup(ContextImpl context, String who,
sendMessage(H.CLEAN_UP_CONTEXT, cci);
}

@Override
public void handleFixedRotationAdjustments(@NonNull IBinder token,
@Nullable FixedRotationAdjustments fixedRotationAdjustments) {
handleFixedRotationAdjustments(token, fixedRotationAdjustments, null /* overrideConfig */);
}

/**
* Applies the rotation adjustments to override display information in resources belong to the
* provided token. If the token is activity token, the adjustments also apply to application
Expand All @@ -3265,51 +3259,39 @@ public void handleFixedRotationAdjustments(@NonNull IBinder token,
* @param fixedRotationAdjustments The information to override the display adjustments of
* corresponding resources. If it is null, the exiting override
* will be cleared.
* @param overrideConfig The override configuration of activity. It is used to override
* application configuration. If it is non-null, it means the token is
* confirmed as activity token. Especially when launching new activity,
* {@link #mActivities} hasn't put the new token.
*/
private void handleFixedRotationAdjustments(@NonNull IBinder token,
@Nullable FixedRotationAdjustments fixedRotationAdjustments,
@Nullable Configuration overrideConfig) {
// The element of application configuration override is set only if the application
// adjustments are needed, because activity already has its own override configuration.
final Configuration[] appConfigOverride;
final Consumer<DisplayAdjustments> override;
if (fixedRotationAdjustments != null) {
appConfigOverride = new Configuration[1];
override = displayAdjustments -> {
displayAdjustments.setFixedRotationAdjustments(fixedRotationAdjustments);
if (appConfigOverride[0] != null) {
displayAdjustments.getConfiguration().updateFrom(appConfigOverride[0]);
}
};
} else {
appConfigOverride = null;
override = null;
}
@Override
public void handleFixedRotationAdjustments(@NonNull IBinder token,
@Nullable FixedRotationAdjustments fixedRotationAdjustments) {
final Consumer<DisplayAdjustments> override = fixedRotationAdjustments != null
? displayAdjustments -> displayAdjustments
.setFixedRotationAdjustments(fixedRotationAdjustments)
: null;
if (!mResourcesManager.overrideTokenDisplayAdjustments(token, override)) {
// No resources are associated with the token.
return;
}
if (overrideConfig == null) {
final ActivityClientRecord r = mActivities.get(token);
if (r == null) {
// It is not an activity token. Nothing to do for application.
return;
}
overrideConfig = r.overrideConfig;
}
if (appConfigOverride != null) {
appConfigOverride[0] = overrideConfig;
if (mActivities.get(token) == null) {
// Nothing to do for application if it is not an activity token.
return;
}

// Apply the last override to application resources for compatibility. Because the Resources
// of Display can be from application, e.g.
// applicationContext.getSystemService(DisplayManager.class).getDisplay(displayId)
// and the deprecated usage:
// applicationContext.getSystemService(WindowManager.class).getDefaultDisplay();
overrideApplicationDisplayAdjustments(token, override);
}

/**
* Applies the last override to application resources for compatibility. Because the Resources
* of Display can be from application, e.g.
* applicationContext.getSystemService(DisplayManager.class).getDisplay(displayId)
* and the deprecated usage:
* applicationContext.getSystemService(WindowManager.class).getDefaultDisplay();
*
* @param token The owner and target of the override.
* @param override The display adjustments override for application resources. If it is null,
* the override of the token will be removed and pop the last one to use.
*/
private void overrideApplicationDisplayAdjustments(@NonNull IBinder token,
@Nullable Consumer<DisplayAdjustments> override) {
final Consumer<DisplayAdjustments> appOverride;
if (mActiveRotationAdjustments == null) {
mActiveRotationAdjustments = new ArrayList<>(2);
Expand Down Expand Up @@ -3542,8 +3524,13 @@ private ContextImpl createBaseContextForActivity(ActivityClientRecord r) {
// The rotation adjustments must be applied before creating the activity, so the activity
// can get the adjusted display info during creation.
if (r.mPendingFixedRotationAdjustments != null) {
handleFixedRotationAdjustments(r.token, r.mPendingFixedRotationAdjustments,
r.overrideConfig);
// The adjustments should have been set by handleLaunchActivity, so the last one is the
// override for activity resources.
if (mActiveRotationAdjustments != null && !mActiveRotationAdjustments.isEmpty()) {
mResourcesManager.overrideTokenDisplayAdjustments(r.token,
mActiveRotationAdjustments.get(
mActiveRotationAdjustments.size() - 1).second);
}
r.mPendingFixedRotationAdjustments = null;
}

Expand Down Expand Up @@ -3582,6 +3569,13 @@ public Activity handleLaunchActivity(ActivityClientRecord r,
mProfiler.startProfiling();
}

if (r.mPendingFixedRotationAdjustments != null) {
// The rotation adjustments must be applied before handling configuration, so process
// level display metrics can be adjusted.
overrideApplicationDisplayAdjustments(r.token, adjustments ->
adjustments.setFixedRotationAdjustments(r.mPendingFixedRotationAdjustments));
}

// Make sure we are running with the most recent config.
handleConfigurationChanged(null, null);

Expand Down Expand Up @@ -5112,6 +5106,7 @@ ActivityClientRecord performDestroyActivity(IBinder token, boolean finishing,
}
}
r.setState(ON_DESTROY);
mLastReportedWindowingMode.remove(r.activity.getActivityToken());
}
schedulePurgeIdler();
// updatePendingActivityConfiguration() reads from mActivities to update
Expand Down Expand Up @@ -5776,7 +5771,15 @@ private void handleConfigurationChanged(Configuration config, CompatibilityInfo
if (DEBUG_CONFIGURATION) Slog.v(TAG, "Handle configuration changed: "
+ config);

mResourcesManager.applyConfigurationToResourcesLocked(config, compat);
final Resources appResources = mInitialApplication.getResources();
if (appResources.hasOverrideDisplayAdjustments()) {
// The value of Display#getRealSize will be adjusted by FixedRotationAdjustments,
// but Display#getSize refers to DisplayAdjustments#mConfiguration. So the rotated
// configuration also needs to set to the adjustments for consistency.
appResources.getDisplayAdjustments().getConfiguration().updateFrom(config);
}
mResourcesManager.applyConfigurationToResourcesLocked(config, compat,
appResources.getDisplayAdjustments());
updateLocaleListFromAppContext(mInitialApplication.getApplicationContext(),
mResourcesManager.getConfiguration().getLocales());

Expand Down Expand Up @@ -7389,7 +7392,8 @@ private void attach(boolean system, long startSeq) {
// We need to apply this change to the resources immediately, because upon returning
// the view hierarchy will be informed about it.
if (mResourcesManager.applyConfigurationToResourcesLocked(globalConfig,
null /* compat */)) {
null /* compat */,
mInitialApplication.getResources().getDisplayAdjustments())) {
updateLocaleListFromAppContext(mInitialApplication.getApplicationContext(),
mResourcesManager.getConfiguration().getLocales());

Expand Down
15 changes: 13 additions & 2 deletions core/java/android/app/ActivityView.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,20 +105,31 @@ public ActivityView(Context context, AttributeSet attrs, int defStyle,
public ActivityView(
@NonNull Context context, @NonNull AttributeSet attrs, int defStyle,
boolean singleTaskInstance, boolean usePublicVirtualDisplay) {
this(context, attrs, defStyle, singleTaskInstance, usePublicVirtualDisplay, false);
this(context, attrs, defStyle, singleTaskInstance, usePublicVirtualDisplay,
false /* disableSurfaceViewBackgroundLayer */);
}

/** @hide */
public ActivityView(
@NonNull Context context, @NonNull AttributeSet attrs, int defStyle,
boolean singleTaskInstance, boolean usePublicVirtualDisplay,
boolean disableSurfaceViewBackgroundLayer) {
this(context, attrs, defStyle, singleTaskInstance, usePublicVirtualDisplay,
disableSurfaceViewBackgroundLayer, false /* useTrustedDisplay */);
}

// TODO(b/162901735): Refactor ActivityView with Builder
/** @hide */
public ActivityView(
@NonNull Context context, @NonNull AttributeSet attrs, int defStyle,
boolean singleTaskInstance, boolean usePublicVirtualDisplay,
boolean disableSurfaceViewBackgroundLayer, boolean useTrustedDisplay) {
super(context, attrs, defStyle);
if (useTaskOrganizer()) {
mTaskEmbedder = new TaskOrganizerTaskEmbedder(context, this);
} else {
mTaskEmbedder = new VirtualDisplayTaskEmbedder(context, this, singleTaskInstance,
usePublicVirtualDisplay);
usePublicVirtualDisplay, useTrustedDisplay);
}
mSurfaceView = new SurfaceView(context, null, 0, 0, disableSurfaceViewBackgroundLayer);
// Since ActivityView#getAlpha has been overridden, we should use parent class's alpha
Expand Down
Loading

0 comments on commit 2aa6ed1

Please sign in to comment.