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

Commit 80fe5964 authored by Xin Li's avatar Xin Li
Browse files

Merge QQ3A.200605.002 into master

Bug: 158095402
Merged-In: I5e28537689d1a53e99f91eafd494eb3a0c890f46
Change-Id: I436ef37a509cbe56d02c6d8d3a38c776f4b4883f
parents b101411b afbf7781
Loading
Loading
Loading
Loading
+33 −5
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#include <linux/fb.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/wait.h>

#include <binder/ProcessState.h>

@@ -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;
    }
+0 −29
Original line number Diff line number Diff line
@@ -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
+0 −3
Original line number Diff line number Diff line
@@ -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,
+3 −0
Original line number Diff line number Diff line
@@ -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);
}
+1 −6
Original line number Diff line number Diff line
@@ -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;
Loading