Loading cmds/screencap/screencap.cpp +33 −5 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <linux/fb.h> #include <sys/ioctl.h> #include <sys/mman.h> #include <sys/wait.h> #include <binder/ProcessState.h> Loading Loading @@ -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; } Loading core/java/android/accounts/AccountManager.java +0 −29 Original line number Diff line number Diff line Loading @@ -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 Loading core/java/android/accounts/IAccountManager.aidl +0 −3 Original line number Diff line number Diff line Loading @@ -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, Loading core/java/android/app/ActivityManagerInternal.java +3 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import android.content.pm.UserInfo; import android.os.Bundle; import android.os.IBinder; import android.os.TransactionTooLargeException; import android.view.RemoteAnimationAdapter; import java.util.ArrayList; import java.util.List; Loading Loading @@ -345,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); } core/java/android/app/AppOpsManagerInternal.java +0 −29 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package android.app; import android.annotation.NonNull; import android.util.SparseIntArray; import com.android.internal.util.function.QuadFunction; Loading Loading @@ -76,20 +75,6 @@ public abstract class AppOpsManagerInternal { */ 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. * Loading @@ -97,18 +82,4 @@ public abstract class AppOpsManagerInternal { * @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); } Loading
cmds/screencap/screencap.cpp +33 −5 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <linux/fb.h> #include <sys/ioctl.h> #include <sys/mman.h> #include <sys/wait.h> #include <binder/ProcessState.h> Loading Loading @@ -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; } Loading
core/java/android/accounts/AccountManager.java +0 −29 Original line number Diff line number Diff line Loading @@ -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 Loading
core/java/android/accounts/IAccountManager.aidl +0 −3 Original line number Diff line number Diff line Loading @@ -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, Loading
core/java/android/app/ActivityManagerInternal.java +3 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import android.content.pm.UserInfo; import android.os.Bundle; import android.os.IBinder; import android.os.TransactionTooLargeException; import android.view.RemoteAnimationAdapter; import java.util.ArrayList; import java.util.List; Loading Loading @@ -345,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); }
core/java/android/app/AppOpsManagerInternal.java +0 −29 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package android.app; import android.annotation.NonNull; import android.util.SparseIntArray; import com.android.internal.util.function.QuadFunction; Loading Loading @@ -76,20 +75,6 @@ public abstract class AppOpsManagerInternal { */ 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. * Loading @@ -97,18 +82,4 @@ public abstract class AppOpsManagerInternal { * @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); }