Skip to content

Commit

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

Android 11.0.0 Release 38 (RQ3A.210605.005)
  • Loading branch information
raiyanbinmohsin committed Jun 9, 2021
2 parents 82ca685 + ba595d5 commit 112b99c
Show file tree
Hide file tree
Showing 434 changed files with 5,066 additions and 3,198 deletions.
16 changes: 8 additions & 8 deletions cmds/statsd/src/atoms.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3612,11 +3612,11 @@ message AppStartOccurred {
// Empty if not set.
optional string launch_token = 13;

// The compiler filter used when when the package was optimized.
optional int32 package_optimization_compilation_filter = 14;

// The reason why the package was optimized.
optional int32 package_optimization_compilation_reason = 15;
optional int32 package_optimization_compilation_reason = 14;

// The compiler filter used when when the package was optimized.
optional int32 package_optimization_compilation_filter = 15;
}

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

// The compiler filter used when when the package was optimized.
optional int32 package_optimization_compilation_filter = 7;

// The reason why the package was optimized.
optional int32 package_optimization_compilation_reason = 8;
optional int32 package_optimization_compilation_reason = 7;

// The compiler filter used when when the package was optimized.
optional int32 package_optimization_compilation_filter = 8;
}

/**
Expand Down
6 changes: 0 additions & 6 deletions core/java/android/app/Activity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5183,12 +5183,6 @@ protected void onApplyThemeResource(Resources.Theme theme, @StyleRes int resid,
* #checkSelfPermission(String)}.
* </p>
* <p>
* Calling this API for permissions already granted to your app would show UI
* to the user to decide whether the app can still hold these permissions. This
* can be useful if the way your app uses data guarded by the permissions
* changes significantly.
* </p>
* <p>
* You cannot request a permission if your activity sets {@link
* android.R.styleable#AndroidManifestActivity_noHistory noHistory} to
* <code>true</code> because in this case the activity would not receive
Expand Down
22 changes: 22 additions & 0 deletions core/java/android/app/ActivityManagerInternal.java
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,21 @@ public abstract void setDebugFlagsForStartingActivity(ActivityInfo aInfo, int st
*/
public abstract boolean hasRunningForegroundService(int uid, int foregroundServiceType);

/**
* Returns {@code true} if the given notification channel currently has a
* notification associated with a foreground service. This is an AMS check
* because that is the source of truth for the FGS state.
*/
public abstract boolean hasForegroundServiceNotification(String pkg, @UserIdInt int userId,
String channelId);

/**
* If the given app has any FGSs whose notifications are in the given channel,
* stop them.
*/
public abstract void stopForegroundServicesForChannel(String pkg, @UserIdInt int userId,
String channelId);

/**
* Registers the specified {@code processObserver} to be notified of future changes to
* process state.
Expand Down Expand Up @@ -440,4 +455,11 @@ public abstract int broadcastIntent(Intent intent,
* @return true if exists, false otherwise.
*/
public abstract boolean isPendingTopUid(int uid);

public abstract void tempAllowWhileInUsePermissionInFgs(int uid, long duration);

public abstract boolean isTempAllowlistedForFgsWhileInUse(int uid);

public abstract boolean canAllowWhileInUsePermissionInFgs(int pid, int uid,
@NonNull String packageName);
}
4 changes: 4 additions & 0 deletions core/java/android/app/ActivityThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -4603,6 +4603,10 @@ public void handleTopResumedActivityChanged(IBinder token, boolean onTop, String
}

if (r.isTopResumedActivity == onTop) {
if (!Build.IS_DEBUGGABLE) {
Slog.w(TAG, "Activity top position already set to onTop=" + onTop);
return;
}
throw new IllegalStateException("Activity top position already set to onTop=" + onTop);
}

Expand Down
4 changes: 2 additions & 2 deletions core/java/android/app/AppOpsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -2436,9 +2436,9 @@ public static String flagsToString(@OpFlags int flags) {
false, // READ_MEDIA_AUDIO
false, // WRITE_MEDIA_AUDIO
false, // READ_MEDIA_VIDEO
false, // WRITE_MEDIA_VIDEO
true, // WRITE_MEDIA_VIDEO
false, // READ_MEDIA_IMAGES
false, // WRITE_MEDIA_IMAGES
true, // WRITE_MEDIA_IMAGES
true, // LEGACY_STORAGE
false, // ACCESS_ACCESSIBILITY
false, // READ_DEVICE_IDENTIFIERS
Expand Down
7 changes: 7 additions & 0 deletions core/java/android/app/admin/DevicePolicyManagerInternal.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package android.app.admin;

import android.annotation.Nullable;
import android.annotation.UserIdInt;
import android.content.ComponentName;
import android.content.Intent;
Expand Down Expand Up @@ -221,6 +222,7 @@ public abstract void broadcastIntentToCrossProfileManifestReceiversAsUser(Intent
/**
* Returns the profile owner component for the given user, or {@code null} if there is not one.
*/
@Nullable
public abstract ComponentName getProfileOwnerAsUser(int userHandle);

/**
Expand All @@ -234,4 +236,9 @@ public abstract void broadcastIntentToCrossProfileManifestReceiversAsUser(Intent
* {@link #supportsResetOp(int)} is true.
*/
public abstract void resetOp(int op, String packageName, @UserIdInt int userId);

/**
* Returns whether the given package is a device owner or a profile owner in the calling user.
*/
public abstract boolean isDeviceOrProfileOwnerInCallingUser(String packageName);
}
22 changes: 20 additions & 2 deletions core/java/android/app/backup/BackupManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.app.compat.CompatChanges;
import android.compat.annotation.ChangeId;
import android.compat.annotation.EnabledAfter;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
Expand Down Expand Up @@ -391,6 +395,17 @@ public boolean isBackupEnabled() {
return false;
}


/**
* If this change is enabled, the {@code BACKUP} permission needed for
* {@code isBackupServiceActive()} will be enforced on the service end
* rather than client-side in {@link BackupManager}.
* @hide
*/
@ChangeId
@EnabledAfter(targetSdkVersion = Build.VERSION_CODES.R)
public static final long IS_BACKUP_SERVICE_ACTIVE_ENFORCE_PERMISSION_IN_SERVICE = 158482162;

/**
* Report whether the backup mechanism is currently active.
* When it is inactive, the device will not perform any backup operations, nor will it
Expand All @@ -401,8 +416,11 @@ public boolean isBackupEnabled() {
@SystemApi
@RequiresPermission(android.Manifest.permission.BACKUP)
public boolean isBackupServiceActive(UserHandle user) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP,
"isBackupServiceActive");
if (!CompatChanges.isChangeEnabled(
IS_BACKUP_SERVICE_ACTIVE_ENFORCE_PERMISSION_IN_SERVICE)) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP,
"isBackupServiceActive");
}
checkServiceBinder();
if (sService != null) {
try {
Expand Down
4 changes: 4 additions & 0 deletions core/java/android/content/pm/parsing/ParsingPackageImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
public static ForInternedStringValueMap sForInternedStringValueMap =
Parcelling.Cache.getOrCreate(ForInternedStringValueMap.class);
public static ForStringSet sForStringSet = Parcelling.Cache.getOrCreate(ForStringSet.class);
public static ForInternedStringSet sForInternedStringSet =
Parcelling.Cache.getOrCreate(ForInternedStringSet.class);
protected static ParsedIntentInfo.StringPairListParceler sForIntentInfoPairs =
Parcelling.Cache.getOrCreate(ParsedIntentInfo.StringPairListParceler.class);

Expand Down Expand Up @@ -1026,6 +1028,7 @@ public void writeToParcel(Parcel dest, int flags) {
dest.writeBoolean(this.forceQueryable);
dest.writeParcelableList(this.queriesIntents, flags);
sForInternedStringList.parcel(this.queriesPackages, dest, flags);
sForInternedStringSet.parcel(this.queriesProviders, dest, flags);
dest.writeString(this.appComponentFactory);
dest.writeString(this.backupAgentName);
dest.writeInt(this.banner);
Expand Down Expand Up @@ -1188,6 +1191,7 @@ public ParsingPackageImpl(Parcel in) {
this.forceQueryable = in.readBoolean();
this.queriesIntents = in.createTypedArrayList(Intent.CREATOR);
this.queriesPackages = sForInternedStringList.unparcel(in);
this.queriesProviders = sForInternedStringSet.unparcel(in);
this.appComponentFactory = in.readString();
this.backupAgentName = in.readString();
this.banner = in.readInt();
Expand Down
7 changes: 6 additions & 1 deletion core/java/android/hardware/camera2/CameraManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1367,6 +1367,8 @@ public void onCameraClosed(String id) {
// devices going offline (in real world scenarios, these permissions aren't
// changeable). Future calls to getCameraIdList() will reflect the changes in
// the camera id list after getCameraIdListNoLazy() is called.
// We need to remove the torch ids which may have been associated with the
// devices removed as well. This is the same situation.
cameraStatuses = mCameraService.addListener(testListener);
mCameraService.removeListener(testListener);
for (CameraStatus c : cameraStatuses) {
Expand All @@ -1385,6 +1387,7 @@ public void onCameraClosed(String id) {
}
for (String id : deviceIdsToRemove) {
onStatusChangedLocked(ICameraServiceListener.STATUS_NOT_PRESENT, id);
mTorchStatus.remove(id);
}
} catch (ServiceSpecificException e) {
// Unexpected failure
Expand Down Expand Up @@ -2051,7 +2054,9 @@ public void binderDied() {
// Tell listeners that the cameras and torch modes are unavailable and schedule a
// reconnection to camera service. When camera service is reconnected, the camera
// and torch statuses will be updated.
for (int i = 0; i < mDeviceStatus.size(); i++) {
// Iterate from the end to the beginning befcause onStatusChangedLocked removes
// entries from the ArrayMap.
for (int i = mDeviceStatus.size() - 1; i >= 0; i--) {
String cameraId = mDeviceStatus.keyAt(i);
onStatusChangedLocked(ICameraServiceListener.STATUS_NOT_PRESENT, cameraId);
}
Expand Down
3 changes: 3 additions & 0 deletions core/java/android/hardware/display/DisplayManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ public final class DisplayManager {
* {@link #EXTRA_WIFI_DISPLAY_STATUS} extra.
* </p><p>
* This broadcast is only sent to registered receivers and can only be sent by the system.
* </p><p>
* {@link android.Manifest.permission#ACCESS_FINE_LOCATION} permission is required to
* receive this broadcast.
* </p>
* @hide
*/
Expand Down
2 changes: 1 addition & 1 deletion core/java/android/hardware/usb/AccessoryFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void write(XmlSerializer serializer)throws IOException {
public boolean matches(UsbAccessory acc) {
if (mManufacturer != null && !acc.getManufacturer().equals(mManufacturer)) return false;
if (mModel != null && !acc.getModel().equals(mModel)) return false;
return !(mVersion != null && !acc.getVersion().equals(mVersion));
return !(mVersion != null && !mVersion.equals(acc.getVersion()));
}

/**
Expand Down
6 changes: 6 additions & 0 deletions core/java/android/nfc/NfcAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,12 @@ public static NfcAdapter getDefaultAdapter(Context context) {
throw new IllegalArgumentException(
"context not associated with any application (using a mock context?)");
}

if (getServiceInterface() == null) {
// NFC is not available
return null;
}

/* use getSystemService() for consistency */
NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE);
if (manager == null) {
Expand Down
49 changes: 49 additions & 0 deletions core/java/android/os/Process.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@

import libcore.io.IoUtils;

import java.io.BufferedReader;
import java.io.FileDescriptor;
import java.io.FileReader;
import java.io.IOException;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.concurrent.TimeoutException;

/**
Expand Down Expand Up @@ -202,6 +206,12 @@ public class Process {
*/
public static final int SE_UID = 1068;

/**
* Defines the UID/GID for the iorapd.
* @hide
*/
public static final int IORAPD_UID = 1071;

/**
* Defines the UID/GID for the NetworkStack app.
* @hide
Expand Down Expand Up @@ -1393,4 +1403,43 @@ public static void waitForProcessDeath(int pid, int timeout)
}

private static native int nativePidFdOpen(int pid, int flags) throws ErrnoException;

/**
* Checks if a process corresponding to a specific pid owns any file locks.
* @param pid The process ID for which we want to know the existence of file locks.
* @return true If the process holds any file locks, false otherwise.
* @throws IOException if /proc/locks can't be accessed.
*
* @hide
*/
public static boolean hasFileLocks(int pid) throws Exception {
BufferedReader br = null;

try {
br = new BufferedReader(new FileReader("/proc/locks"));
String line;

while ((line = br.readLine()) != null) {
StringTokenizer st = new StringTokenizer(line);

for (int i = 0; i < 5 && st.hasMoreTokens(); i++) {
String str = st.nextToken();
try {
if (i == 4 && Integer.parseInt(str) == pid) {
return true;
}
} catch (NumberFormatException nfe) {
throw new Exception("Exception parsing /proc/locks at \" "
+ line + " \", token #" + i);
}
}
}

return false;
} finally {
if (br != null) {
br.close();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ public InsetsAnimationThreadControlRunner(SparseArray<InsetsSourceControl> contr
mControl = new InsetsAnimationControlImpl(controls, frame, state, listener,
types, mCallbacks, durationMs, interpolator, animationType);
InsetsAnimationThread.getHandler().post(() -> {
if (mControl.isCancelled()) {
return;
}
Trace.asyncTraceBegin(Trace.TRACE_TAG_VIEW,
"InsetsAsyncAnimation: " + WindowInsets.Type.toString(types), types);
listener.onReady(mControl, types);
Expand Down
15 changes: 11 additions & 4 deletions core/java/android/view/InsetsSourceConsumer.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,20 @@ public void setControl(@Nullable InsetsSourceControl control,
InsetsState.typeToString(control.getType()),
mController.getHost().getRootViewTitle()));
}
// We are loosing control
if (mSourceControl == null) {
// We are loosing control
mController.notifyControlRevoked(this);

// Restore server visibility.
mState.getSource(getType()).setVisible(
mController.getLastDispatchedState().getSource(getType()).isVisible());
// Check if we need to restore server visibility.
final InsetsSource source = mState.getSource(mType);
final boolean serverVisibility =
mController.getLastDispatchedState().getSourceOrDefaultVisibility(mType);
if (source.isVisible() != serverVisibility) {
source.setVisible(serverVisibility);
mController.notifyVisibilityChanged();
}

// For updateCompatSysUiVisibility
applyLocalVisibilityOverride();
} else {
// We are gaining control, and need to run an animation since previous state
Expand Down
Loading

0 comments on commit 112b99c

Please sign in to comment.