Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
opt: getCurrentUserId
Browse files Browse the repository at this point in the history
  • Loading branch information
Sevtinge committed Dec 16, 2024
1 parent 4b56181 commit 715e51e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package com.sevtinge.hyperceiler.prefs;

import static com.sevtinge.hyperceiler.BuildConfig.APPLICATION_ID;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.getCurrentUserId;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.getWhoAmI;
import static com.sevtinge.hyperceiler.utils.shell.ShellUtils.safeExecCommandWithRoot;

Expand Down Expand Up @@ -100,8 +101,7 @@ private boolean isHidden(Context context) {

@SuppressLint("Range")
private void getScope() {
UserHandle currentUserHandle = android.os.Process.myUserHandle();
int userId = currentUserHandle.hashCode();
int userId = getCurrentUserId();

safeExecCommandWithRoot("mkdir -p /data/local/tmp/HyperCeiler/cache/ && cp -r /data/adb/lspd/config /data/local/tmp/HyperCeiler/cache/ && chmod -R 777 /data/local/tmp/HyperCeiler/cache/config");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.getAndroidVersion;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.getBuildDate;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.getCurrentUserId;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.getHyperOSVersion;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.getMiuiVersion;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.getSystemVersionIncremental;
Expand Down Expand Up @@ -131,6 +132,7 @@ public String getDebugInfo() {
// propertiesCheck.put("RootPermission", String.valueOf(ShellInit.ready()));
propertiesCheck.put("WhoAmI", getWhoAmI());
propertiesCheck.put("LoggerStatus", IS_LOGGER_ALIVE + ", " + LOGGER_CHECKER_ERR_CODE);
propertiesCheck.put("CurrentUserId", String.valueOf(getCurrentUserId()));
} catch (Exception ignored) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ fun getBuilder(): String = getProp("ro.build.user")
fun getBaseOs(): String = if (getProp("ro.build.version.base_os") != "") getProp("ro.build.version.base_os") else "null"
fun getRomAuthor(): String = getProp("ro.rom.author") + getProp("ro.romid")
fun getWhoAmI(): String = safeExecCommandWithRoot("whoami")
fun getCurrentUserId(): Int = Process.myUserHandle().hashCode()

/**
* 获取设备 Android 版本
Expand Down

0 comments on commit 715e51e

Please sign in to comment.