mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-23 18:15:30 +00:00
Pre-grant permissions if possible
This commit is contained in:
parent
7a4a5c8992
commit
a54114f149
@ -129,7 +129,7 @@ object HideAPK {
|
|||||||
launchApp(activity, pkg)
|
launchApp(activity, pkg)
|
||||||
}
|
}
|
||||||
|
|
||||||
val cmd = "adb_pm_install $repack ${activity.applicationInfo.uid}"
|
val cmd = "adb_pm_install $repack $pkg"
|
||||||
if (Shell.cmd(cmd).exec().isSuccess) return true
|
if (Shell.cmd(cmd).exec().isSuccess) return true
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -177,7 +177,7 @@ object HideAPK {
|
|||||||
launchApp(activity, APPLICATION_ID)
|
launchApp(activity, APPLICATION_ID)
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
}
|
}
|
||||||
val cmd = "adb_pm_install $apk ${activity.applicationInfo.uid}"
|
val cmd = "adb_pm_install $apk $APPLICATION_ID"
|
||||||
if (Shell.cmd(cmd).await().isSuccess) return
|
if (Shell.cmd(cmd).await().isSuccess) return
|
||||||
val success = withContext(Dispatchers.IO) {
|
val success = withContext(Dispatchers.IO) {
|
||||||
try {
|
try {
|
||||||
|
@ -133,11 +133,12 @@ adb_pm_install() {
|
|||||||
local tmp=/data/local/tmp/temp.apk
|
local tmp=/data/local/tmp/temp.apk
|
||||||
cp -f "$1" $tmp
|
cp -f "$1" $tmp
|
||||||
chmod 644 $tmp
|
chmod 644 $tmp
|
||||||
su 2000 -c pm install $tmp || pm install $tmp || su 1000 -c pm install $tmp
|
su 2000 -c pm install -g $tmp || pm install -g $tmp || su 1000 -c pm install -g $tmp
|
||||||
local res=$?
|
local res=$?
|
||||||
rm -f $tmp
|
rm -f $tmp
|
||||||
# Note: change this will kill self
|
if [ $res = 0 ]; then
|
||||||
[ $res != 0 ] && appops set "$2" REQUEST_INSTALL_PACKAGES allow
|
appops set "$2" REQUEST_INSTALL_PACKAGES allow
|
||||||
|
fi
|
||||||
return $res
|
return $res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,6 +154,7 @@ constexpr char install_script[] = R"EOF(
|
|||||||
APK=%s
|
APK=%s
|
||||||
log -t Magisk "pm_install: $APK"
|
log -t Magisk "pm_install: $APK"
|
||||||
log -t Magisk "pm_install: $(pm install -g -r $APK 2>&1)"
|
log -t Magisk "pm_install: $(pm install -g -r $APK 2>&1)"
|
||||||
|
appops set com.topjohnwu.magisk REQUEST_INSTALL_PACKAGES allow
|
||||||
rm -f $APK
|
rm -f $APK
|
||||||
)EOF";
|
)EOF";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user