Skip to content

Commit

Permalink
Merge branch 'r11.0' of github.com:RevengeOS/android_frameworks_base …
Browse files Browse the repository at this point in the history
…into r11.0

* 'r11.0' of github.com:RevengeOS/android_frameworks_base: (278 commits)
  Revert "base: Allow disabling screenshot shutter sound [1/2]"
  base: Allow disabling screenshot shutter sound [1/2]
  Prevent apk-in-apex from being registered under wrong apex
  Mark intents as immutable
  Restrict alarm broadcast
  Import translations. DO NOT MERGE ANYWHERE
  Import translations. DO NOT MERGE ANYWHERE
  getCameraIdListNoLazy : remove system cameras from mTorchStatus as well.
  DO NOT MERGE Set focus to PasswordTextView by default.
  Update carrier privilege check in enforceSubscriptionPlanAccess
  Increase maximum allowed size for status bar icons
  Increase maximum allowed size for status bar icons
  Rebind InstallSuccess UI on resume
  Revert "DO NOT MERGE Remove focus on PasswordTextView"
  Import translations. DO NOT MERGE ANYWHERE
  Import translations. DO NOT MERGE ANYWHERE
  Import translations. DO NOT MERGE ANYWHERE
  Import translations. DO NOT MERGE ANYWHERE
  Import translations. DO NOT MERGE ANYWHERE
  Import translations. DO NOT MERGE ANYWHERE
  ...
  • Loading branch information
Pulkit077 committed Jun 10, 2021
2 parents 46c8f3e + 949d19e commit 44c72c5
Show file tree
Hide file tree
Showing 445 changed files with 5,715 additions and 3,374 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
58 changes: 50 additions & 8 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 Expand Up @@ -875,37 +878,76 @@ public interface DisplayListener {
public interface DeviceConfig {

/**
* Key for refresh rate in the zone defined by thresholds.
* Key for refresh rate in the low zone defined by thresholds.
*
* Note that the name and value don't match because they were added before we had a high
* zone to consider.
* @see android.provider.DeviceConfig#NAMESPACE_DISPLAY_MANAGER
* @see android.R.integer#config_defaultZoneBehavior
*/
String KEY_REFRESH_RATE_IN_ZONE = "refresh_rate_in_zone";
String KEY_REFRESH_RATE_IN_LOW_ZONE = "refresh_rate_in_zone";

/**
* Key for accessing the display brightness thresholds for the configured refresh rate zone.
* Key for accessing the low display brightness thresholds for the configured refresh
* rate zone.
* The value will be a pair of comma separated integers representing the minimum and maximum
* thresholds of the zone, respectively, in display backlight units (i.e. [0, 255]).
*
* Note that the name and value don't match because they were added before we had a high
* zone to consider.
*
* @see android.provider.DeviceConfig#NAMESPACE_DISPLAY_MANAGER
* @see android.R.array#config_brightnessThresholdsOfPeakRefreshRate
* @hide
*/
String KEY_PEAK_REFRESH_RATE_DISPLAY_BRIGHTNESS_THRESHOLDS =
String KEY_FIXED_REFRESH_RATE_LOW_DISPLAY_BRIGHTNESS_THRESHOLDS =
"peak_refresh_rate_brightness_thresholds";

/**
* Key for accessing the ambient brightness thresholds for the configured refresh rate zone.
* The value will be a pair of comma separated integers representing the minimum and maximum
* thresholds of the zone, respectively, in lux.
* Key for accessing the low ambient brightness thresholds for the configured refresh
* rate zone. The value will be a pair of comma separated integers representing the minimum
* and maximum thresholds of the zone, respectively, in lux.
*
* Note that the name and value don't match because they were added before we had a high
* zone to consider.
*
* @see android.provider.DeviceConfig#NAMESPACE_DISPLAY_MANAGER
* @see android.R.array#config_ambientThresholdsOfPeakRefreshRate
* @hide
*/
String KEY_PEAK_REFRESH_RATE_AMBIENT_BRIGHTNESS_THRESHOLDS =
String KEY_FIXED_REFRESH_RATE_LOW_AMBIENT_BRIGHTNESS_THRESHOLDS =
"peak_refresh_rate_ambient_thresholds";
/**
* Key for refresh rate in the high zone defined by thresholds.
*
* @see android.provider.DeviceConfig#NAMESPACE_DISPLAY_MANAGER
* @see android.R.integer#config_fixedRefreshRateInHighZone
*/
String KEY_REFRESH_RATE_IN_HIGH_ZONE = "refresh_rate_in_high_zone";

/**
* Key for accessing the display brightness thresholds for the configured refresh rate zone.
* The value will be a pair of comma separated integers representing the minimum and maximum
* thresholds of the zone, respectively, in display backlight units (i.e. [0, 255]).
*
* @see android.provider.DeviceConfig#NAMESPACE_DISPLAY_MANAGER
* @see android.R.array#config_brightnessHighThresholdsOfFixedRefreshRate
* @hide
*/
String KEY_FIXED_REFRESH_RATE_HIGH_DISPLAY_BRIGHTNESS_THRESHOLDS =
"fixed_refresh_rate_high_display_brightness_thresholds";

/**
* Key for accessing the ambient brightness thresholds for the configured refresh rate zone.
* The value will be a pair of comma separated integers representing the minimum and maximum
* thresholds of the zone, respectively, in lux.
*
* @see android.provider.DeviceConfig#NAMESPACE_DISPLAY_MANAGER
* @see android.R.array#config_ambientHighThresholdsOfFixedRefreshRate
* @hide
*/
String KEY_FIXED_REFRESH_RATE_HIGH_AMBIENT_BRIGHTNESS_THRESHOLDS =
"fixed_refresh_rate_high_ambient_brightness_thresholds";
/**
* Key for default peak refresh rate
*
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
Loading

0 comments on commit 44c72c5

Please sign in to comment.