Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
RikkaW committed Jan 14, 2021
1 parent 1c0e738 commit 8bc48cf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 9 additions & 3 deletions api/src/main/java/rikka/shizuku/Shizuku.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ public static void onBinderReceived(@Nullable IBinder newBinder, String packageN
serverUid = -1;
serverVersion = -1;
serverContext = null;

scheduleBinderDeadListeners();
} else {
if (binder != null) {
binder.unlinkToDeath(DEATH_RECIPIENT, 0);
Expand Down Expand Up @@ -313,12 +315,16 @@ public static void transactRemote(@NonNull Parcel data, @Nullable Parcel reply,

/**
* Start a new process at remote service, parameters are passed to {@link Runtime#exec(String, String[], java.io.File)}.
* <br>From version 11, like "su", the process will be killed when the caller process is dead. If you have complicated
* requirements, use {@link Shizuku#bindUserService(UserServiceArgs, ServiceConnection)}.
* <p>
* Note, you may need to read/write streams from RemoteProcess in different threads.
* </p>
*
* @return RemoteProcess holds the binder of remote process
* @deprecated If transactRemote is not enough for you, use UserService.
* @deprecated This method should only be used when you are transitioning from "su".
* Use {@link Shizuku#transactRemote(Parcel, Parcel, int)} for binder calls and {@link Shizuku#bindUserService(UserServiceArgs, ServiceConnection)}
* for complicated requirements.
*/
@Deprecated
public static ShizukuRemoteProcess newProcess(@NonNull String[] cmd, @Nullable String[] env, @Nullable String dir) {
Expand Down Expand Up @@ -381,12 +387,12 @@ public static int getLatestServiceVersion() {
}

/**
* Check permission at remote service.
* Check if remote service has specific permission.
*
* @param permission permission name
* @return PackageManager.PERMISSION_DENIED or PackageManager.PERMISSION_GRANTED
*/
public static int checkPermission(String permission) {
public static int checkRemotePermission(String permission) {
if (serverUid == 0) return PackageManager.PERMISSION_GRANTED;
try {
return requireService().checkPermission(permission);
Expand Down
3 changes: 2 additions & 1 deletion manifest.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ ext {
api_version_code = 1
api_version_major = 11
api_version_minor = 0
api_version_name = "${api_version_major}.${api_version_minor}"
api_version_path = 0
api_version_name = "${api_version_major}.${api_version_minor}.${api_version_path}"
}

0 comments on commit 8bc48cf

Please sign in to comment.