Merge "DO NOT MERGE - Merge qt-qpr1-dev-plus-aosp@6304901 into stage-aosp-master" into stage-aosp-master
This commit is contained in:
committed by
Android (Google) Code Review
commit
4c1f620af6
@@ -1942,35 +1942,6 @@ public class AccountManager {
|
||||
}.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Removes the shared account.
|
||||
* @param account the account to remove
|
||||
* @param user the user to remove the account from
|
||||
* @return
|
||||
*/
|
||||
public boolean removeSharedAccount(final Account account, UserHandle user) {
|
||||
try {
|
||||
boolean val = mService.removeSharedAccountAsUser(account, user.getIdentifier());
|
||||
return val;
|
||||
} catch (RemoteException re) {
|
||||
throw re.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public Account[] getSharedAccounts(UserHandle user) {
|
||||
try {
|
||||
return mService.getSharedAccountsAsUser(user.getIdentifier());
|
||||
} catch (RemoteException re) {
|
||||
throw re.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirms that the user knows the password for an account to make extra
|
||||
* sure they are the owner of the account. The user-entered password can
|
||||
|
||||
@@ -80,14 +80,11 @@ interface IAccountManager {
|
||||
String authTokenType);
|
||||
|
||||
/* Shared accounts */
|
||||
Account[] getSharedAccountsAsUser(int userId);
|
||||
boolean removeSharedAccountAsUser(in Account account, int userId);
|
||||
void addSharedAccountsFromParentUser(int parentUserId, int userId, String opPackageName);
|
||||
|
||||
/* Account renaming. */
|
||||
void renameAccount(in IAccountManagerResponse response, in Account accountToRename, String newName);
|
||||
String getPreviousName(in Account account);
|
||||
boolean renameSharedAccountAsUser(in Account accountToRename, String newName, int userId);
|
||||
|
||||
/* Add account in two steps. */
|
||||
void startAddAccountSession(in IAccountManagerResponse response, String accountType,
|
||||
|
||||
@@ -344,4 +344,7 @@ public abstract class ActivityManagerInternal {
|
||||
* Unregisters the specified {@code processObserver}.
|
||||
*/
|
||||
public abstract void unregisterProcessObserver(IProcessObserver processObserver);
|
||||
|
||||
/** Returns true if the given UID is registered as an active instrumentation. */
|
||||
public abstract boolean isActiveInstrumentation(int uid);
|
||||
}
|
||||
|
||||
@@ -41,8 +41,7 @@ final class DisabledWallpaperManager extends WallpaperManager {
|
||||
// Don't need to worry about synchronization
|
||||
private static DisabledWallpaperManager sInstance;
|
||||
|
||||
// TODO(b/138939803): STOPSHIP changed to false and/or remove it
|
||||
private static final boolean DEBUG = true;
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
@NonNull
|
||||
static DisabledWallpaperManager getInstance() {
|
||||
@@ -66,10 +65,6 @@ final class DisabledWallpaperManager extends WallpaperManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO(b/138939803): STOPSHIP methods below should not be necessary,
|
||||
// callers should check if isWallpaperSupported(), consider removing them to keep this class
|
||||
// simpler
|
||||
|
||||
private static <T> T unsupported() {
|
||||
if (DEBUG) Log.w(TAG, "unsupported method called; returning null", new Exception());
|
||||
return null;
|
||||
|
||||
@@ -116,7 +116,9 @@ import android.view.WindowManagerImpl;
|
||||
* The display manager keeps track of all displays in the system. However, not all
|
||||
* displays are appropriate for showing presentations. For example, if an activity
|
||||
* attempted to show a presentation on the main display it might obscure its own content
|
||||
* (it's like opening a dialog on top of your activity).
|
||||
* (it's like opening a dialog on top of your activity). Creating a presentation on the main
|
||||
* display will result in {@link android.view.WindowManager.InvalidDisplayException} being thrown
|
||||
* when invoking {@link #show()}.
|
||||
* </p><p>
|
||||
* Here's how to identify suitable displays for showing presentations using
|
||||
* {@link DisplayManager#getDisplays(String)} and the
|
||||
@@ -243,7 +245,7 @@ public class Presentation extends Dialog {
|
||||
/**
|
||||
* Inherited from {@link Dialog#show}. Will throw
|
||||
* {@link android.view.WindowManager.InvalidDisplayException} if the specified secondary
|
||||
* {@link Display} can't be found.
|
||||
* {@link Display} can't be found or if it does not have {@link Display#FLAG_PRESENTATION} set.
|
||||
*/
|
||||
@Override
|
||||
public void show() {
|
||||
|
||||
@@ -1007,4 +1007,16 @@ public abstract class PackageManagerInternal {
|
||||
* Migrates legacy obb data to its new location.
|
||||
*/
|
||||
public abstract void migrateLegacyObbData();
|
||||
|
||||
/**
|
||||
* Ensures that we block deletion of unused packages on user removal. This is purely for the
|
||||
* purpose of ensuring that b/141413692 is not reproducible on Q.
|
||||
*/
|
||||
public abstract void notifyingOnNextUserRemovalForTest();
|
||||
|
||||
/**
|
||||
* Notifies PackageManager of the removal of a user. This is purely for the purpose of ensuring
|
||||
* that b/141413692 is not reproducible on Q.
|
||||
*/
|
||||
public abstract void userRemovedForTest();
|
||||
}
|
||||
|
||||
@@ -1157,8 +1157,11 @@ public final class AssetManager implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
if (mObject != 0) {
|
||||
nativeDestroy(mObject);
|
||||
synchronized (this) {
|
||||
if (mObject != 0) {
|
||||
nativeDestroy(mObject);
|
||||
mObject = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -701,6 +701,33 @@ public final class CameraManager {
|
||||
public void onCameraAccessPrioritiesChanged() {
|
||||
// default empty implementation
|
||||
}
|
||||
|
||||
/**
|
||||
* A camera device has been opened by an application.
|
||||
*
|
||||
* <p>The default implementation of this method does nothing.</p>
|
||||
*
|
||||
* @param cameraId The unique identifier of the new camera.
|
||||
* @param packageId The package Id of the application opening the camera.
|
||||
*
|
||||
* @see #onCameraClosed
|
||||
*/
|
||||
/** @hide */
|
||||
public void onCameraOpened(@NonNull String cameraId, @NonNull String packageId) {
|
||||
// default empty implementation
|
||||
}
|
||||
|
||||
/**
|
||||
* A previously-opened camera has been closed.
|
||||
*
|
||||
* <p>The default implementation of this method does nothing.</p>
|
||||
*
|
||||
* @param cameraId The unique identifier of the closed camera.
|
||||
*/
|
||||
/** @hide */
|
||||
public void onCameraClosed(@NonNull String cameraId) {
|
||||
// default empty implementation
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1139,6 +1166,38 @@ public final class CameraManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void postSingleCameraOpenedUpdate(final AvailabilityCallback callback,
|
||||
final Executor executor, final String id, final String packageId) {
|
||||
final long ident = Binder.clearCallingIdentity();
|
||||
try {
|
||||
executor.execute(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
callback.onCameraOpened(id, packageId);
|
||||
}
|
||||
});
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(ident);
|
||||
}
|
||||
}
|
||||
|
||||
private void postSingleCameraClosedUpdate(final AvailabilityCallback callback,
|
||||
final Executor executor, final String id) {
|
||||
final long ident = Binder.clearCallingIdentity();
|
||||
try {
|
||||
executor.execute(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
callback.onCameraClosed(id);
|
||||
}
|
||||
});
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(ident);
|
||||
}
|
||||
}
|
||||
|
||||
private void postSingleUpdate(final AvailabilityCallback callback, final Executor executor,
|
||||
final String id, final int status) {
|
||||
if (isAvailable(status)) {
|
||||
@@ -1401,6 +1460,32 @@ public final class CameraManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraOpened(String cameraId, String clientPackageId) {
|
||||
synchronized (mLock) {
|
||||
final int callbackCount = mCallbackMap.size();
|
||||
for (int i = 0; i < callbackCount; i++) {
|
||||
Executor executor = mCallbackMap.valueAt(i);
|
||||
final AvailabilityCallback callback = mCallbackMap.keyAt(i);
|
||||
|
||||
postSingleCameraOpenedUpdate(callback, executor, cameraId, clientPackageId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraClosed(String cameraId) {
|
||||
synchronized (mLock) {
|
||||
final int callbackCount = mCallbackMap.size();
|
||||
for (int i = 0; i < callbackCount; i++) {
|
||||
Executor executor = mCallbackMap.valueAt(i);
|
||||
final AvailabilityCallback callback = mCallbackMap.keyAt(i);
|
||||
|
||||
postSingleCameraClosedUpdate(callback, executor, cameraId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to connect to camera service after some delay if any client registered camera
|
||||
* availability callback or torch status callback.
|
||||
|
||||
@@ -157,7 +157,6 @@ public class ExternalVibration implements Parcelable {
|
||||
out.writeInt(mUid);
|
||||
out.writeString(mPkg);
|
||||
writeAudioAttributes(mAttrs, out, flags);
|
||||
out.writeParcelable(mAttrs, flags);
|
||||
out.writeStrongBinder(mController.asBinder());
|
||||
out.writeStrongBinder(mToken);
|
||||
}
|
||||
|
||||
@@ -172,13 +172,6 @@ public class GraphicsEnvironment {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether application is debuggable
|
||||
*/
|
||||
private static boolean isDebuggable(Context context) {
|
||||
return (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store the layer paths available to the loader.
|
||||
*/
|
||||
@@ -233,7 +226,7 @@ public class GraphicsEnvironment {
|
||||
// 2. ENABLE_GPU_DEBUG_LAYERS is true
|
||||
// 3. Package name is equal to GPU_DEBUG_APP
|
||||
|
||||
if (isDebuggable(context) || (getCanLoadSystemLibraries() == 1)) {
|
||||
if (isDebuggable()) {
|
||||
|
||||
final int enable = coreSettings.getInt(Settings.Global.ENABLE_GPU_DEBUG_LAYERS, 0);
|
||||
|
||||
@@ -414,9 +407,7 @@ public class GraphicsEnvironment {
|
||||
* Check for ANGLE debug package, but only for apps that can load them (dumpable)
|
||||
*/
|
||||
private String getAngleDebugPackage(Context context, Bundle coreSettings) {
|
||||
final boolean appIsDebuggable = isDebuggable(context);
|
||||
final boolean deviceIsDebuggable = getCanLoadSystemLibraries() == 1;
|
||||
if (appIsDebuggable || deviceIsDebuggable) {
|
||||
if (isDebuggable()) {
|
||||
String debugPackage;
|
||||
|
||||
if (coreSettings != null) {
|
||||
@@ -451,12 +442,8 @@ public class GraphicsEnvironment {
|
||||
* - devices that are running a userdebug build (ro.debuggable) or can inject libraries for
|
||||
* debugging (PR_SET_DUMPABLE).
|
||||
*/
|
||||
final boolean appIsDebuggable = isDebuggable(context);
|
||||
final boolean deviceIsDebuggable = getCanLoadSystemLibraries() == 1;
|
||||
if (!(appIsDebuggable || deviceIsDebuggable)) {
|
||||
Log.v(TAG, "Skipping loading temporary rules file: "
|
||||
+ "appIsDebuggable = " + appIsDebuggable + ", "
|
||||
+ "adbRootEnabled = " + deviceIsDebuggable);
|
||||
if (!isDebuggable()) {
|
||||
Log.v(TAG, "Skipping loading temporary rules file");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -725,7 +712,7 @@ public class GraphicsEnvironment {
|
||||
|
||||
final boolean enablePrereleaseDriver =
|
||||
(ai.metaData != null && ai.metaData.getBoolean(METADATA_DEVELOPER_DRIVER_ENABLE))
|
||||
|| getCanLoadSystemLibraries() == 1;
|
||||
|| isDebuggable();
|
||||
|
||||
// Priority for Game Driver settings global on confliction (Higher priority comes first):
|
||||
// 1. GAME_DRIVER_ALL_APPS
|
||||
@@ -901,7 +888,7 @@ public class GraphicsEnvironment {
|
||||
return "";
|
||||
}
|
||||
|
||||
private static native int getCanLoadSystemLibraries();
|
||||
private static native boolean isDebuggable();
|
||||
private static native void setLayerPaths(ClassLoader classLoader, String layerPaths);
|
||||
private static native void setDebugLayers(String layers);
|
||||
private static native void setDebugLayersGLES(String layers);
|
||||
|
||||
@@ -106,4 +106,5 @@ interface IUserManager {
|
||||
String getUserName();
|
||||
long getUserStartRealtime();
|
||||
long getUserUnlockRealtime();
|
||||
void notifyOnNextUserRemoveForTest();
|
||||
}
|
||||
|
||||
@@ -1274,6 +1274,16 @@ public class UserManager {
|
||||
return RoSystemProperties.FW_SYSTEM_USER_SPLIT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* @return Whether the device is running in a headless system user mode. It means the headless
|
||||
* user (system user) runs system services and system UI, but is not associated with any real
|
||||
* person. Secondary users can be created to be associated with real person.
|
||||
*/
|
||||
public static boolean isHeadlessSystemUserMode() {
|
||||
return RoSystemProperties.MULTIUSER_HEADLESS_SYSTEM_USER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether guest user is always ephemeral
|
||||
* @hide
|
||||
|
||||
@@ -92,10 +92,7 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
@@ -424,13 +421,6 @@ public final class InputMethodManager {
|
||||
int mCursorCandStart;
|
||||
int mCursorCandEnd;
|
||||
|
||||
/**
|
||||
* Initial startInput with {@link StartInputReason.WINDOW_FOCUS_GAIN} is executed
|
||||
* in a background thread. Later, if there is an actual startInput it will wait on
|
||||
* main thread till the background thread completes.
|
||||
*/
|
||||
private CompletableFuture<Void> mWindowFocusGainFuture;
|
||||
|
||||
/**
|
||||
* The instance that has previously been sent to the input method.
|
||||
*/
|
||||
@@ -655,14 +645,14 @@ public final class InputMethodManager {
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Check focus again in case that "onWindowFocus" is called before
|
||||
// handling this message.
|
||||
if (mServedView != null && canStartInput(mServedView)) {
|
||||
if (checkFocusNoStartInput(mRestartOnNextWindowFocus)) {
|
||||
final int reason = active ? StartInputReason.ACTIVATED_BY_IMMS
|
||||
: StartInputReason.DEACTIVATED_BY_IMMS;
|
||||
startInputInner(reason, null, 0, 0, 0);
|
||||
// Check focus again in case that "onWindowFocus" is called before
|
||||
// handling this message.
|
||||
if (mServedView != null && canStartInput(mServedView)) {
|
||||
if (checkFocusNoStartInput(mRestartOnNextWindowFocus)) {
|
||||
final int reason = active ? StartInputReason.ACTIVATED_BY_IMMS
|
||||
: StartInputReason.DEACTIVATED_BY_IMMS;
|
||||
startInputInner(reason, null, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -1225,10 +1215,6 @@ public final class InputMethodManager {
|
||||
*/
|
||||
void clearBindingLocked() {
|
||||
if (DEBUG) Log.v(TAG, "Clearing binding!");
|
||||
if (mWindowFocusGainFuture != null) {
|
||||
mWindowFocusGainFuture.cancel(false /* mayInterruptIfRunning */);
|
||||
mWindowFocusGainFuture = null;
|
||||
}
|
||||
clearConnectionLocked();
|
||||
setInputChannelLocked(null);
|
||||
mBindSequence = -1;
|
||||
@@ -1612,18 +1598,6 @@ public final class InputMethodManager {
|
||||
boolean startInputInner(@StartInputReason int startInputReason,
|
||||
@Nullable IBinder windowGainingFocus, @StartInputFlags int startInputFlags,
|
||||
@SoftInputModeFlags int softInputMode, int windowFlags) {
|
||||
if (startInputReason != StartInputReason.WINDOW_FOCUS_GAIN
|
||||
&& mWindowFocusGainFuture != null) {
|
||||
try {
|
||||
mWindowFocusGainFuture.get();
|
||||
} catch (ExecutionException | InterruptedException e) {
|
||||
// do nothing
|
||||
} catch (CancellationException e) {
|
||||
// window no longer has focus.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
final View view;
|
||||
synchronized (mH) {
|
||||
view = mServedView;
|
||||
@@ -1977,38 +1951,31 @@ public final class InputMethodManager {
|
||||
startInputFlags |= StartInputFlags.FIRST_WINDOW_FOCUS_GAIN;
|
||||
}
|
||||
|
||||
final boolean forceNewFocus1 = forceNewFocus;
|
||||
final int startInputFlags1 = startInputFlags;
|
||||
if (mWindowFocusGainFuture != null) {
|
||||
mWindowFocusGainFuture.cancel(false/* mayInterruptIfRunning */);
|
||||
if (checkFocusNoStartInput(forceNewFocus)) {
|
||||
// We need to restart input on the current focus view. This
|
||||
// should be done in conjunction with telling the system service
|
||||
// about the window gaining focus, to help make the transition
|
||||
// smooth.
|
||||
if (startInputInner(StartInputReason.WINDOW_FOCUS_GAIN, rootView.getWindowToken(),
|
||||
startInputFlags, softInputMode, windowFlags)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
mWindowFocusGainFuture = CompletableFuture.runAsync(() -> {
|
||||
if (checkFocusNoStartInput(forceNewFocus1)) {
|
||||
// We need to restart input on the current focus view. This
|
||||
// should be done in conjunction with telling the system service
|
||||
// about the window gaining focus, to help make the transition
|
||||
// smooth.
|
||||
if (startInputInner(StartInputReason.WINDOW_FOCUS_GAIN, rootView.getWindowToken(),
|
||||
startInputFlags1, softInputMode, windowFlags)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// For some reason we didn't do a startInput + windowFocusGain, so
|
||||
// we'll just do a window focus gain and call it a day.
|
||||
synchronized (mH) {
|
||||
try {
|
||||
if (DEBUG) Log.v(TAG, "Reporting focus gain, without startInput");
|
||||
mService.startInputOrWindowGainedFocus(
|
||||
StartInputReason.WINDOW_FOCUS_GAIN_REPORT_ONLY, mClient,
|
||||
rootView.getWindowToken(), startInputFlags1, softInputMode, windowFlags,
|
||||
null, null, 0 /* missingMethodFlags */,
|
||||
rootView.getContext().getApplicationInfo().targetSdkVersion);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
// For some reason we didn't do a startInput + windowFocusGain, so
|
||||
// we'll just do a window focus gain and call it a day.
|
||||
synchronized (mH) {
|
||||
try {
|
||||
if (DEBUG) Log.v(TAG, "Reporting focus gain, without startInput");
|
||||
mService.startInputOrWindowGainedFocus(
|
||||
StartInputReason.WINDOW_FOCUS_GAIN_REPORT_ONLY, mClient,
|
||||
rootView.getWindowToken(), startInputFlags, softInputMode, windowFlags,
|
||||
null, null, 0 /* missingMethodFlags */,
|
||||
rootView.getContext().getApplicationInfo().targetSdkVersion);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@@ -2023,10 +1990,6 @@ public final class InputMethodManager {
|
||||
// If the mCurRootView is losing window focus, release the strong reference to it
|
||||
// so as not to prevent it from being garbage-collected.
|
||||
mCurRootView = null;
|
||||
if (mWindowFocusGainFuture != null) {
|
||||
mWindowFocusGainFuture.cancel(false /* mayInterruptIfRunning */);
|
||||
mWindowFocusGainFuture = null;
|
||||
}
|
||||
} else {
|
||||
if (DEBUG) {
|
||||
Log.v(TAG, "Ignoring onPreWindowFocus()."
|
||||
|
||||
Reference in New Issue
Block a user