Skip to content

Commit

Permalink
Merge tag 'android-10.0.0_r37' into ten
Browse files Browse the repository at this point in the history
Android 10.0.0 Release 37 (QQ3A.200605.001)

# gpg: Signature made Mon 01 Jun 2020 09:25:12 PM UTC
# gpg:                using DSA key 4340D13570EF945E83810964E8AD3F819AB10E78
# gpg: Can't check signature: No public key
  • Loading branch information
SKULSHADY committed Jun 5, 2020
2 parents 4133ee4 + 81ee102 commit 9e21371
Show file tree
Hide file tree
Showing 351 changed files with 4,853 additions and 1,865 deletions.
38 changes: 33 additions & 5 deletions cmds/screencap/screencap.cpp
Expand Up @@ -24,6 +24,7 @@
#include <linux/fb.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/wait.h>

#include <binder/ProcessState.h>

Expand Down Expand Up @@ -99,11 +100,38 @@ static uint32_t dataSpaceToInt(ui::Dataspace d)
}

static status_t notifyMediaScanner(const char* fileName) {
String8 cmd("am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_FILE -d file://");
cmd.append(fileName);
cmd.append(" > /dev/null");
int result = system(cmd.string());
if (result < 0) {
std::string filePath("file://");
filePath.append(fileName);
char *cmd[] = {
(char*) "am",
(char*) "broadcast",
(char*) "am",
(char*) "android.intent.action.MEDIA_SCANNER_SCAN_FILE",
(char*) "-d",
&filePath[0],
nullptr
};

int status;
int pid = fork();
if (pid < 0){
fprintf(stderr, "Unable to fork in order to send intent for media scanner.\n");
return UNKNOWN_ERROR;
}
if (pid == 0){
int fd = open("/dev/null", O_WRONLY);
if (fd < 0){
fprintf(stderr, "Unable to open /dev/null for media scanner stdout redirection.\n");
exit(1);
}
dup2(fd, 1);
int result = execvp(cmd[0], cmd);
close(fd);
exit(result);
}
wait(&status);

if (status < 0) {
fprintf(stderr, "Unable to broadcast intent for media scanner.\n");
return UNKNOWN_ERROR;
}
Expand Down
29 changes: 0 additions & 29 deletions core/java/android/accounts/AccountManager.java
Expand Up @@ -1964,35 +1964,6 @@ public Boolean bundleToResult(Bundle bundle) throws AuthenticatorException {
}.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
Expand Down
3 changes: 0 additions & 3 deletions core/java/android/accounts/IAccountManager.aidl
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion core/java/android/app/ActivityManagerInternal.java
Expand Up @@ -29,7 +29,6 @@
import android.os.Bundle;
import android.os.IBinder;
import android.os.TransactionTooLargeException;
import android.view.RemoteAnimationAdapter;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -345,4 +344,7 @@ public abstract void setDebugFlagsForStartingActivity(ActivityInfo aInfo, int st
* 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);
}
29 changes: 0 additions & 29 deletions core/java/android/app/AppOpsManagerInternal.java
Expand Up @@ -16,7 +16,6 @@

package android.app;

import android.annotation.NonNull;
import android.util.SparseIntArray;

import com.android.internal.util.function.QuadFunction;
Expand Down Expand Up @@ -76,39 +75,11 @@ int noteOperation(int code, int uid, String packageName,
*/
public abstract void setDeviceAndProfileOwners(SparseIntArray owners);

/**
* Sets the app-ops mode for a certain app-op and uid.
*
* <p>Similar as {@link AppOpsManager#setUidMode} but does not require the package manager to be
* working. Hence this can be used very early during boot.
*
* <p>Only for internal callers. Does <u>not</u> verify that package name belongs to uid.
*
* @param code The op code to set.
* @param uid The UID for which to set.
* @param mode The new mode to set.
*/
public abstract void setUidMode(int code, int uid, int mode);

/**
* Set all {@link #setMode (package) modes} for this uid to the default value.
*
* @param code The app-op
* @param uid The uid
*/
public abstract void setAllPkgModesToDefault(int code, int uid);

/**
* Get the (raw) mode of an app-op.
*
* <p>Does <u>not</u> verify that package belongs to uid. The caller needs to do that.
*
* @param code The code of the op
* @param uid The uid of the package the op belongs to
* @param packageName The package the op belongs to
*
* @return The mode of the op
*/
public abstract @AppOpsManager.Mode int checkOperationUnchecked(int code, int uid,
@NonNull String packageName);
}
7 changes: 1 addition & 6 deletions core/java/android/app/DisabledWallpaperManager.java
Expand Up @@ -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() {
Expand All @@ -66,10 +65,6 @@ public boolean isSetWallpaperAllowed() {
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;
Expand Down
6 changes: 4 additions & 2 deletions core/java/android/bluetooth/BluetoothAdapter.java
Expand Up @@ -1201,9 +1201,11 @@ public String getName() {
public boolean factoryReset() {
try {
mServiceLock.readLock().lock();
if (mService != null) {
return mService.factoryReset();
if (mService != null && mService.factoryReset()
&& mManagerService != null && mManagerService.onFactoryReset()) {
return true;
}
Log.e(TAG, "factoryReset(): Setting persist.bluetooth.factoryreset to retry later");
SystemProperties.set("persist.bluetooth.factoryreset", "true");
} catch (RemoteException e) {
Log.e(TAG, "", e);
Expand Down
12 changes: 12 additions & 0 deletions core/java/android/content/pm/PackageManagerInternal.java
Expand Up @@ -999,4 +999,16 @@ public abstract void setRuntimePermissionsFingerPrint(@NonNull String fingerPrin
* 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();
}
85 changes: 85 additions & 0 deletions core/java/android/hardware/camera2/CameraManager.java
Expand Up @@ -702,6 +702,33 @@ public void onCameraUnavailable(@NonNull String cameraId) {
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
}
}

/**
Expand Down Expand Up @@ -1151,6 +1178,38 @@ public void run() {
}
}

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)) {
Expand Down Expand Up @@ -1427,6 +1486,32 @@ public void onCameraAccessPrioritiesChanged() {
}
}

@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.
Expand Down
2 changes: 2 additions & 0 deletions core/java/android/net/INetworkPolicyListener.aidl
Expand Up @@ -15,6 +15,7 @@
*/

package android.net;
import android.telephony.SubscriptionPlan;

/** {@hide} */
oneway interface INetworkPolicyListener {
Expand All @@ -23,4 +24,5 @@ oneway interface INetworkPolicyListener {
void onRestrictBackgroundChanged(boolean restrictBackground);
void onUidPoliciesChanged(int uid, int uidPolicies);
void onSubscriptionOverride(int subId, int overrideMask, int overrideValue);
void onSubscriptionPlansChanged(int subId, in SubscriptionPlan[] plans);
}
2 changes: 2 additions & 0 deletions core/java/android/net/NetworkPolicyManager.java
Expand Up @@ -31,6 +31,7 @@
import android.os.Build;
import android.os.RemoteException;
import android.os.UserHandle;
import android.telephony.SubscriptionPlan;
import android.util.DebugUtils;
import android.util.Pair;
import android.util.Range;
Expand Down Expand Up @@ -387,5 +388,6 @@ public static class Listener extends INetworkPolicyListener.Stub {
@Override public void onRestrictBackgroundChanged(boolean restrictBackground) { }
@Override public void onUidPoliciesChanged(int uid, int uidPolicies) { }
@Override public void onSubscriptionOverride(int subId, int overrideMask, int overrideValue) { }
@Override public void onSubscriptionPlansChanged(int subId, SubscriptionPlan[] plans) { }
}
}

0 comments on commit 9e21371

Please sign in to comment.