mirror of
https://github.com/topjohnwu/Magisk
synced 2024-11-16 00:13:57 +01:00
Skip getSessionInfo
This commit is contained in:
parent
637a8af234
commit
f827755aaf
@ -101,30 +101,25 @@ public final class APKInstall {
|
|||||||
} else if (sessionId.equals(intent.getAction())) {
|
} else if (sessionId.equals(intent.getAction())) {
|
||||||
int status = intent.getIntExtra(EXTRA_STATUS, STATUS_FAILURE_INVALID);
|
int status = intent.getIntExtra(EXTRA_STATUS, STATUS_FAILURE_INVALID);
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case STATUS_PENDING_USER_ACTION:
|
case STATUS_PENDING_USER_ACTION ->
|
||||||
userAction = intent.getParcelableExtra(Intent.EXTRA_INTENT);
|
userAction = intent.getParcelableExtra(Intent.EXTRA_INTENT);
|
||||||
break;
|
case STATUS_SUCCESS -> {
|
||||||
case STATUS_SUCCESS:
|
|
||||||
if (packageName == null) {
|
if (packageName == null) {
|
||||||
onSuccess(context);
|
onSuccess(context);
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
default:
|
default -> {
|
||||||
int id = intent.getIntExtra(EXTRA_SESSION_ID, 0);
|
int id = intent.getIntExtra(EXTRA_SESSION_ID, 0);
|
||||||
if (id > 0) {
|
var installer = context.getPackageManager().getPackageInstaller();
|
||||||
var installer = context.getPackageManager().getPackageInstaller();
|
try {
|
||||||
var info = installer.getSessionInfo(id);
|
installer.abandonSession(id);
|
||||||
if (info != null) {
|
} catch (SecurityException ignored) {
|
||||||
try {
|
|
||||||
installer.abandonSession(info.getSessionId());
|
|
||||||
} catch (Throwable ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (onFailure != null) {
|
if (onFailure != null) {
|
||||||
onFailure.run();
|
onFailure.run();
|
||||||
}
|
}
|
||||||
context.getApplicationContext().unregisterReceiver(this);
|
context.getApplicationContext().unregisterReceiver(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user