Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Android10 s3 release #589

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion core/java/android/app/AppOpsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -834,9 +834,12 @@ public static String flagsToString(@OpFlags int flags) {
public static final int OP_ACCESS_ACCESSIBILITY = 88;
/** @hide Read the device identifiers (IMEI / MEID, IMSI, SIM / Build serial) */
public static final int OP_READ_DEVICE_IDENTIFIERS = 89;
/** @hide Read location metadata from media */
public static final int OP_ACCESS_MEDIA_LOCATION = 90;

/** @hide */
@UnsupportedAppUsage
public static final int _NUM_OP = 90;
public static final int _NUM_OP = 91;

/** Access to coarse location information. */
public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
Expand Down Expand Up @@ -1107,6 +1110,9 @@ public static String flagsToString(@OpFlags int flags) {
@TestApi
@SystemApi
public static final String OPSTR_LEGACY_STORAGE = "android:legacy_storage";
/** @hide Read location metadata from media */
public static final String OPSTR_ACCESS_MEDIA_LOCATION = "android:access_media_location";

/** @hide Interact with accessibility. */
@SystemApi
public static final String OPSTR_ACCESS_ACCESSIBILITY = "android:access_accessibility";
Expand Down Expand Up @@ -1134,6 +1140,7 @@ public static String flagsToString(@OpFlags int flags) {
// Storage
OP_READ_EXTERNAL_STORAGE,
OP_WRITE_EXTERNAL_STORAGE,
OP_ACCESS_MEDIA_LOCATION,
// Location
OP_COARSE_LOCATION,
OP_FINE_LOCATION,
Expand Down Expand Up @@ -1273,6 +1280,7 @@ public static String flagsToString(@OpFlags int flags) {
OP_LEGACY_STORAGE, // LEGACY_STORAGE
OP_ACCESS_ACCESSIBILITY, // ACCESS_ACCESSIBILITY
OP_READ_DEVICE_IDENTIFIERS, // READ_DEVICE_IDENTIFIERS
OP_ACCESS_MEDIA_LOCATION, // ACCESS_MEDIA_LOCATION
};

/**
Expand Down Expand Up @@ -1369,6 +1377,7 @@ public static String flagsToString(@OpFlags int flags) {
OPSTR_LEGACY_STORAGE,
OPSTR_ACCESS_ACCESSIBILITY,
OPSTR_READ_DEVICE_IDENTIFIERS,
OPSTR_ACCESS_MEDIA_LOCATION,
};

/**
Expand Down Expand Up @@ -1466,6 +1475,7 @@ public static String flagsToString(@OpFlags int flags) {
"LEGACY_STORAGE",
"ACCESS_ACCESSIBILITY",
"READ_DEVICE_IDENTIFIERS",
"ACCESS_MEDIA_LOCATION",
};

/**
Expand Down Expand Up @@ -1564,6 +1574,7 @@ public static String flagsToString(@OpFlags int flags) {
null, // no permission for OP_LEGACY_STORAGE
null, // no permission for OP_ACCESS_ACCESSIBILITY
null, // no direct permission for OP_READ_DEVICE_IDENTIFIERS
Manifest.permission.ACCESS_MEDIA_LOCATION,
};

/**
Expand Down Expand Up @@ -1662,6 +1673,7 @@ public static String flagsToString(@OpFlags int flags) {
null, // LEGACY_STORAGE
null, // ACCESS_ACCESSIBILITY
null, // READ_DEVICE_IDENTIFIERS
null, // ACCESS_MEDIA_LOCATION
};

/**
Expand Down Expand Up @@ -1759,6 +1771,7 @@ public static String flagsToString(@OpFlags int flags) {
false, // LEGACY_STORAGE
false, // ACCESS_ACCESSIBILITY
false, // READ_DEVICE_IDENTIFIERS
false, // ACCESS_MEDIA_LOCATION
};

/**
Expand Down Expand Up @@ -1855,6 +1868,7 @@ public static String flagsToString(@OpFlags int flags) {
AppOpsManager.MODE_DEFAULT, // LEGACY_STORAGE
AppOpsManager.MODE_ALLOWED, // ACCESS_ACCESSIBILITY
AppOpsManager.MODE_ERRORED, // READ_DEVICE_IDENTIFIERS
AppOpsManager.MODE_ALLOWED, // ALLOW_MEDIA_LOCATION
};

/**
Expand Down Expand Up @@ -1955,6 +1969,7 @@ public static String flagsToString(@OpFlags int flags) {
false, // LEGACY_STORAGE
false, // ACCESS_ACCESSIBILITY
false, // READ_DEVICE_IDENTIFIERS
false, // ACCESS_MEDIA_LOCATION
};

/**
Expand Down
296 changes: 266 additions & 30 deletions core/java/android/content/PermissionChecker.java

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/java/android/service/notification/ZenModeConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -1639,7 +1639,7 @@ public static class ZenRule implements Parcelable {
@UnsupportedAppUsage
public String name; // required for automatic
@UnsupportedAppUsage
public int zenMode;
public int zenMode; // ie: Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS
@UnsupportedAppUsage
public Uri conditionId; // required for automatic
public Condition condition; // optional
Expand Down
24 changes: 17 additions & 7 deletions core/java/android/speech/RecognitionService.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,23 @@ public StartListeningArgs(Intent intent, IRecognitionListener listener, int call
* Checks whether the caller has sufficient permissions
*
* @param listener to send the error message to in case of error
* @param forDataDelivery If the permission check is for delivering the sensitive data.
* @return {@code true} if the caller has enough permissions, {@code false} otherwise
*/
private boolean checkPermissions(IRecognitionListener listener) {
private boolean checkPermissions(IRecognitionListener listener, boolean forDataDelivery) {
if (DBG) Log.d(TAG, "checkPermissions");
if (PermissionChecker.checkCallingOrSelfPermission(this,
android.Manifest.permission.RECORD_AUDIO) == PermissionChecker.PERMISSION_GRANTED) {
return true;
if (forDataDelivery) {
if (PermissionChecker.checkCallingOrSelfPermissionForDataDelivery(this,
android.Manifest.permission.RECORD_AUDIO)
== PermissionChecker.PERMISSION_GRANTED) {
return true;
}
} else {
if (PermissionChecker.checkCallingOrSelfPermissionForPreflight(this,
android.Manifest.permission.RECORD_AUDIO)
== PermissionChecker.PERMISSION_GRANTED) {
return true;
}
}
try {
Log.e(TAG, "call for recognition service without RECORD_AUDIO permissions");
Expand Down Expand Up @@ -342,7 +352,7 @@ public RecognitionServiceBinder(RecognitionService service) {
public void startListening(Intent recognizerIntent, IRecognitionListener listener) {
if (DBG) Log.d(TAG, "startListening called by:" + listener.asBinder());
final RecognitionService service = mServiceRef.get();
if (service != null && service.checkPermissions(listener)) {
if (service != null && service.checkPermissions(listener, true /*forDataDelivery*/)) {
service.mHandler.sendMessage(Message.obtain(service.mHandler,
MSG_START_LISTENING, service.new StartListeningArgs(
recognizerIntent, listener, Binder.getCallingUid())));
Expand All @@ -353,7 +363,7 @@ MSG_START_LISTENING, service.new StartListeningArgs(
public void stopListening(IRecognitionListener listener) {
if (DBG) Log.d(TAG, "stopListening called by:" + listener.asBinder());
final RecognitionService service = mServiceRef.get();
if (service != null && service.checkPermissions(listener)) {
if (service != null && service.checkPermissions(listener, false /*forDataDelivery*/)) {
service.mHandler.sendMessage(Message.obtain(service.mHandler,
MSG_STOP_LISTENING, listener));
}
Expand All @@ -363,7 +373,7 @@ public void stopListening(IRecognitionListener listener) {
public void cancel(IRecognitionListener listener) {
if (DBG) Log.d(TAG, "cancel called by:" + listener.asBinder());
final RecognitionService service = mServiceRef.get();
if (service != null && service.checkPermissions(listener)) {
if (service != null && service.checkPermissions(listener, false /*forDataDelivery*/)) {
service.mHandler.sendMessage(Message.obtain(service.mHandler,
MSG_CANCEL, listener));
}
Expand Down
4 changes: 4 additions & 0 deletions data/etc/platform.xml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@
targetSdk="29">
<new-permission name="android.permission.ACCESS_BACKGROUND_LOCATION" />
</split-permission>
<split-permission name="android.permission.READ_EXTERNAL_STORAGE"
targetSdk="29">
<new-permission name="android.permission.ACCESS_MEDIA_LOCATION" />
</split-permission>

<!-- This is a list of all the libraries available for application
code to link against. -->
Expand Down
10 changes: 6 additions & 4 deletions data/fonts/fonts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -323,14 +323,16 @@
<font weight="700" style="normal">NotoSansLaoUI-Bold.ttf</font>
</family>
<family lang="und-Mymr" variant="elegant">
<font weight="400" style="normal">NotoSansMyanmar-Regular-ZawDecode.ttf</font>
<font weight="700" style="normal">NotoSansMyanmar-Bold-ZawDecode.ttf</font>
<font weight="400" style="normal">NotoSansMyanmar-Regular.otf</font>
<font weight="500" style="normal">NotoSansMyanmar-Medium.otf</font>
<font weight="700" style="normal">NotoSansMyanmar-Bold.otf</font>
<font weight="400" style="normal" fallbackFor="serif">NotoSerifMyanmar-Regular.otf</font>
<font weight="700" style="normal" fallbackFor="serif">NotoSerifMyanmar-Bold.otf</font>
</family>
<family lang="und-Mymr" variant="compact">
<font weight="400" style="normal">NotoSansMyanmarUI-Regular-ZawDecode.ttf</font>
<font weight="700" style="normal">NotoSansMyanmarUI-Bold-ZawDecode.ttf</font>
<font weight="400" style="normal">NotoSansMyanmarUI-Regular.otf</font>
<font weight="500" style="normal">NotoSansMyanmarUI-Medium.otf</font>
<font weight="700" style="normal">NotoSansMyanmarUI-Bold.otf</font>
</family>
<family lang="und-Thaa">
<font weight="400" style="normal">NotoSansThaana-Regular.ttf</font>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ public List<Access> getAppList() {
for (int op : LOCATION_OPS) {
final String permission = AppOpsManager.opToPermission(op);
final int permissionFlags = pm.getPermissionFlags(permission, packageName, user);
if (PermissionChecker.checkPermission(mContext, permission, -1, uid, packageName)
== PermissionChecker.PERMISSION_GRANTED) {
if (PermissionChecker.checkPermissionForPreflight(mContext, permission,
PermissionChecker.PID_UNKNOWN, uid, packageName)
== PermissionChecker.PERMISSION_GRANTED) {
if ((permissionFlags
& PackageManager.FLAG_PERMISSION_USER_SENSITIVE_WHEN_GRANTED) == 0) {
showApp = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ public List<Request> getAppList(boolean showSystemApps) {
final String permission = AppOpsManager.opToPermission(op);
final int permissionFlags = pm.getPermissionFlags(permission, packageName,
user);
if (PermissionChecker.checkPermission(mContext, permission, -1, uid,
packageName)
== PermissionChecker.PERMISSION_GRANTED) {
if (PermissionChecker.checkPermissionForPreflight(mContext, permission,
PermissionChecker.PID_UNKNOWN, uid, packageName)
== PermissionChecker.PERMISSION_GRANTED) {
if ((permissionFlags
& PackageManager.FLAG_PERMISSION_USER_SENSITIVE_WHEN_GRANTED)
== 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
public interface KeyguardMonitor extends CallbackController<Callback> {

boolean isSecure();
boolean canSkipBouncer();
boolean isShowing();
boolean isOccluded();
boolean isKeyguardFadingAway();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@
package com.android.systemui.statusbar.policy;

import android.annotation.NonNull;
import android.app.ActivityManager;
import android.content.Context;

import com.android.internal.util.Preconditions;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.systemui.settings.CurrentUserTracker;

import java.util.ArrayList;

Expand All @@ -39,14 +37,11 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback
private final ArrayList<Callback> mCallbacks = new ArrayList<>();

private final Context mContext;
private final CurrentUserTracker mUserTracker;
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;

private int mCurrentUser;
private boolean mShowing;
private boolean mSecure;
private boolean mOccluded;
private boolean mCanSkipBouncer;

private boolean mListening;
private boolean mKeyguardFadingAway;
Expand All @@ -61,13 +56,6 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback
public KeyguardMonitorImpl(Context context) {
mContext = context;
mKeyguardUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
mUserTracker = new CurrentUserTracker(mContext) {
@Override
public void onUserSwitched(int newUserId) {
mCurrentUser = newUserId;
updateCanSkipBouncerState();
}
};
}

@Override
Expand All @@ -76,10 +64,7 @@ public void addCallback(@NonNull Callback callback) {
mCallbacks.add(callback);
if (mCallbacks.size() != 0 && !mListening) {
mListening = true;
mCurrentUser = ActivityManager.getCurrentUser();
updateCanSkipBouncerState();
mKeyguardUpdateMonitor.registerCallback(this);
mUserTracker.startTracking();
}
}

Expand All @@ -89,7 +74,6 @@ public void removeCallback(@NonNull Callback callback) {
if (mCallbacks.remove(callback) && mCallbacks.size() == 0 && mListening) {
mListening = false;
mKeyguardUpdateMonitor.removeCallback(this);
mUserTracker.stopTracking();
}
}

Expand All @@ -108,11 +92,6 @@ public boolean isOccluded() {
return mOccluded;
}

@Override
public boolean canSkipBouncer() {
return mCanSkipBouncer;
}

public void notifyKeyguardState(boolean showing, boolean secure, boolean occluded) {
if (mShowing == showing && mSecure == secure && mOccluded == occluded) return;
mShowing = showing;
Expand All @@ -123,18 +102,13 @@ public void notifyKeyguardState(boolean showing, boolean secure, boolean occlude

@Override
public void onTrustChanged(int userId) {
updateCanSkipBouncerState();
notifyKeyguardChanged();
}

public boolean isDeviceInteractive() {
return mKeyguardUpdateMonitor.isDeviceInteractive();
}

private void updateCanSkipBouncerState() {
mCanSkipBouncer = mKeyguardUpdateMonitor.getUserCanSkipBouncer(mCurrentUser);
}

private void notifyKeyguardChanged() {
// Copy the list to allow removal during callback.
new ArrayList<>(mCallbacks).forEach(Callback::onKeyguardShowingChanged);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import com.android.systemui.plugins.qs.DetailAdapter;
import com.android.systemui.qs.tiles.UserDetailView;
import com.android.systemui.statusbar.phone.SystemUIDialog;
import com.android.systemui.statusbar.phone.UnlockMethodCache;

import java.io.FileDescriptor;
import java.io.PrintWriter;
Expand Down Expand Up @@ -595,17 +596,19 @@ public static abstract class BaseUserAdapter extends BaseAdapter {

final UserSwitcherController mController;
private final KeyguardMonitor mKeyguardMonitor;
private final UnlockMethodCache mUnlockMethodCache;

protected BaseUserAdapter(UserSwitcherController controller) {
mController = controller;
mKeyguardMonitor = controller.mKeyguardMonitor;
mUnlockMethodCache = UnlockMethodCache.getInstance(controller.mContext);
controller.addAdapter(new WeakReference<>(this));
}

public int getUserCount() {
boolean secureKeyguardShowing = mKeyguardMonitor.isShowing()
&& mKeyguardMonitor.isSecure()
&& !mKeyguardMonitor.canSkipBouncer();
&& !mUnlockMethodCache.canSkipBouncer();
if (!secureKeyguardShowing) {
return mController.getUsers().size();
}
Expand All @@ -627,7 +630,7 @@ public int getUserCount() {
public int getCount() {
boolean secureKeyguardShowing = mKeyguardMonitor.isShowing()
&& mKeyguardMonitor.isSecure()
&& !mKeyguardMonitor.canSkipBouncer();
&& !mUnlockMethodCache.canSkipBouncer();
if (!secureKeyguardShowing) {
return mController.getUsers().size();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,4 @@ public long getKeyguardFadingAwayDelay() {
public long calculateGoingToFullShadeDelay() {
return 0;
}

@Override
public boolean canSkipBouncer() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ private static String typeToString(int type) {
case TYPE_SUPPRESSOR_CHANGED: return "suppressor_changed";
case TYPE_LISTENER_HINTS_CHANGED: return "listener_hints_changed";
case TYPE_SET_NOTIFICATION_POLICY: return "set_notification_policy";
case TYPE_SET_CONSOLIDATED_ZEN_POLICY: return "set_consolidated_policy";
default: return "unknown";
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -942,12 +942,11 @@ private int computeZenMode() {
}

private void applyCustomPolicy(ZenPolicy policy, ZenRule rule) {
if (rule.zenMode == NotificationManager.INTERRUPTION_FILTER_NONE) {
if (rule.zenMode == Global.ZEN_MODE_NO_INTERRUPTIONS) {
policy.apply(new ZenPolicy.Builder()
.disallowAllSounds()
.build());
} else if (rule.zenMode
== NotificationManager.INTERRUPTION_FILTER_ALARMS) {
} else if (rule.zenMode == Global.ZEN_MODE_ALARMS) {
policy.apply(new ZenPolicy.Builder()
.disallowAllSounds()
.allowAlarms(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ public final class DefaultPermissionGrantPolicy {
static {
STORAGE_PERMISSIONS.add(Manifest.permission.READ_EXTERNAL_STORAGE);
STORAGE_PERMISSIONS.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
STORAGE_PERMISSIONS.add(Manifest.permission.ACCESS_MEDIA_LOCATION);
}

private static final int MSG_READ_DEFAULT_PERMISSION_EXCEPTIONS = 1;
Expand Down
Loading