Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c23cfe57 authored by Jean-Baptiste Queru's avatar Jean-Baptiste Queru
Browse files

Merge remote-tracking branch 'goog/jb-mr1-dev-plus-aosp' into HEAD

parents 87a1ac66 f4488d03
Loading
Loading
Loading
Loading
+25 −3
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@ import android.os.Looper;
import android.os.RemoteException;
import android.os.Parcelable;
import android.os.Build;
import android.os.Process;
import android.os.UserHandle;
import android.util.Log;
import android.text.TextUtils;

@@ -42,7 +44,6 @@ import java.util.concurrent.TimeUnit;
import java.util.HashMap;
import java.util.Map;

import com.google.android.collect.Lists;
import com.google.android.collect.Maps;

/**
@@ -396,8 +397,13 @@ public class AccountManager {
     *     (never null) if no accounts of the specified type have been added.
     */
    public Account[] getAccountsByType(String type) {
        return getAccountsByTypeAsUser(type, Process.myUserHandle());
    }

    /** @hide Same as {@link #getAccountsByType(String)} but for a specific user. */
    public Account[] getAccountsByTypeAsUser(String type, UserHandle userHandle) {
        try {
            return mService.getAccounts(type);
            return mService.getAccountsAsUser(type, userHandle.getIdentifier());
        } catch (RemoteException e) {
            // won't ever happen
            throw new RuntimeException(e);
@@ -1175,10 +1181,26 @@ public class AccountManager {
            final Activity activity,
            final AccountManagerCallback<Bundle> callback,
            final Handler handler) {
        return confirmCredentialsAsUser(account, options, activity, callback, handler,
                Process.myUserHandle());
    }

    /**
     * @hide
     * Same as {@link #confirmCredentials(Account, Bundle, Activity, AccountManagerCallback, Handler)}
     * but for the specified user.
     */
    public AccountManagerFuture<Bundle> confirmCredentialsAsUser(final Account account,
            final Bundle options,
            final Activity activity,
            final AccountManagerCallback<Bundle> callback,
            final Handler handler, UserHandle userHandle) {
        if (account == null) throw new IllegalArgumentException("account is null");
        final int userId = userHandle.getIdentifier();
        return new AmsTask(activity, handler, callback) {
            public void doWork() throws RemoteException {
                mService.confirmCredentials(mResponse, account, options, activity != null);
                mService.confirmCredentialsAsUser(mResponse, account, options, activity != null,
                        userId);
            }
        }.start();
    }
+27 −5
Original line number Diff line number Diff line
@@ -1297,8 +1297,17 @@ public class AccountManagerService
        }
    }

    public void confirmCredentials(IAccountManagerResponse response,
            final Account account, final Bundle options, final boolean expectActivityLaunch) {
    @Override
    public void confirmCredentialsAsUser(IAccountManagerResponse response,
            final Account account, final Bundle options, final boolean expectActivityLaunch,
            int userId) {
        // Only allow the system process to read accounts of other users
        if (userId != UserHandle.getCallingUserId()
                && Binder.getCallingUid() != android.os.Process.myUid()) {
            throw new SecurityException("User " + UserHandle.getCallingUserId()
                    + " trying to confirm account credentials for " + userId);
        }

        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "confirmCredentials: " + account
                    + ", response " + response
@@ -1309,7 +1318,7 @@ public class AccountManagerService
        if (response == null) throw new IllegalArgumentException("response is null");
        if (account == null) throw new IllegalArgumentException("account is null");
        checkManageAccountsPermission();
        UserAccounts accounts = getUserAccountsForCaller();
        UserAccounts accounts = getUserAccounts(userId);
        long identityToken = clearCallingIdentity();
        try {
            new Session(accounts, response, account.type, expectActivityLaunch,
@@ -1548,14 +1557,22 @@ public class AccountManagerService
        return runningAccounts.toArray(accountsArray);
    }

    public Account[] getAccounts(String type) {
    @Override
    public Account[] getAccountsAsUser(String type, int userId) {
        // Only allow the system process to read accounts of other users
        if (userId != UserHandle.getCallingUserId()
                && Binder.getCallingUid() != android.os.Process.myUid()) {
            throw new SecurityException("User " + UserHandle.getCallingUserId()
                    + " trying to get account for " + userId);
        }

        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "getAccounts: accountType " + type
                    + ", caller's uid " + Binder.getCallingUid()
                    + ", pid " + Binder.getCallingPid());
        }
        checkReadAccountsPermission();
        UserAccounts accounts = getUserAccountsForCaller();
        UserAccounts accounts = getUserAccounts(userId);
        long identityToken = clearCallingIdentity();
        try {
            synchronized (accounts.cacheLock) {
@@ -1566,6 +1583,11 @@ public class AccountManagerService
        }
    }

    @Override
    public Account[] getAccounts(String type) {
        return getAccountsAsUser(type, UserHandle.getCallingUserId());
    }

    public void getAccountsByFeatures(IAccountManagerResponse response,
            String type, String[] features) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
+3 −2
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ interface IAccountManager {
    String getUserData(in Account account, String key);
    AuthenticatorDescription[] getAuthenticatorTypes();
    Account[] getAccounts(String accountType);
    Account[] getAccountsAsUser(String accountType, int userId);
    void hasFeatures(in IAccountManagerResponse response, in Account account, in String[] features);
    void getAccountsByFeatures(in IAccountManagerResponse response, String accountType, in String[] features);
    boolean addAccount(in Account account, String password, in Bundle extras);
@@ -53,8 +54,8 @@ interface IAccountManager {
        String authTokenType, boolean expectActivityLaunch, in Bundle options);
    void editProperties(in IAccountManagerResponse response, String accountType,
        boolean expectActivityLaunch);
    void confirmCredentials(in IAccountManagerResponse response, in Account account,
        in Bundle options, boolean expectActivityLaunch);
    void confirmCredentialsAsUser(in IAccountManagerResponse response, in Account account,
        in Bundle options, boolean expectActivityLaunch, int userId);
    void getAuthTokenLabel(in IAccountManagerResponse response, String accountType,
        String authTokenType);
}
+20 −16
Original line number Diff line number Diff line
@@ -3495,25 +3495,29 @@ public class Camera {
        }

        /**
         * Returns true if video snapshot is supported. That is, applications
         * <p>Returns true if video snapshot is supported. That is, applications
         * can call {@link #takePicture(Camera.ShutterCallback,
         * Camera.PictureCallback, Camera.PictureCallback, Camera.PictureCallback)}
         * during recording. Applications do not need to call {@link
         * #startPreview()} after taking a picture. The preview will be still
         * active. Other than that, taking a picture during recording is
         * identical to taking a picture normally. All settings and methods
         * related to takePicture work identically. Ex: {@link
         * #getPictureSize()}, {@link #getSupportedPictureSizes()}, {@link
         * #setJpegQuality(int)}, {@link #setRotation(int)}, and etc. The
         * picture will have an EXIF header. {@link #FLASH_MODE_AUTO} and {@link
         * #FLASH_MODE_ON} also still work, but the video will record the flash.
         *
         * Applications can set shutter callback as null to avoid the shutter
         * Camera.PictureCallback, Camera.PictureCallback,
         * Camera.PictureCallback)} during recording. Applications do not need
         * to call {@link #startPreview()} after taking a picture. The preview
         * will be still active. Other than that, taking a picture during
         * recording is identical to taking a picture normally. All settings and
         * methods related to takePicture work identically. Ex:
         * {@link #getPictureSize()}, {@link #getSupportedPictureSizes()},
         * {@link #setJpegQuality(int)}, {@link #setRotation(int)}, and etc. The
         * picture will have an EXIF header. {@link #FLASH_MODE_AUTO} and
         * {@link #FLASH_MODE_ON} also still work, but the video will record the
         * flash.</p>
         *
         * <p>Applications can set shutter callback as null to avoid the shutter
         * sound. It is also recommended to set raw picture and post view
         * callbacks to null to avoid the interrupt of preview display.
         * callbacks to null to avoid the interrupt of preview display.</p>
         *
         * Field-of-view of the recorded video may be different from that of the
         * captured pictures.
         * <p>Field-of-view of the recorded video may be different from that of the
         * captured pictures. The maximum size of a video snapshot may be
         * smaller than that for regular still captures. If the current picture
         * size is set higher than can be supported by video snapshot, the
         * picture will be captured at the maximum supported size instead.</p>
         *
         * @return true if video snapshot is supported.
         */
+2 −0
Original line number Diff line number Diff line
@@ -351,6 +351,8 @@ public class DhcpStateMachine extends StateMachine {
        DhcpInfoInternal dhcpInfoInternal = new DhcpInfoInternal();

        if (dhcpAction == DhcpAction.START) {
            /* Stop any existing DHCP daemon before starting new */
            NetworkUtils.stopDhcp(mInterfaceName);
            if (DBG) Log.d(TAG, "DHCP request on " + mInterfaceName);
            success = NetworkUtils.runDhcp(mInterfaceName, dhcpInfoInternal);
            mDhcpInfo = dhcpInfoInternal;
Loading