ToolsInstaller: restrict to only main app usage

We don't want lots of different packages fighting over who gets to
install the tools.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2020-03-09 05:07:27 -06:00
parent 1235e966d2
commit fd573f6c1c
1 changed files with 2 additions and 0 deletions

View File

@ -105,6 +105,8 @@ public final class ToolsInstaller {
}
public int install() throws RootShellException, IOException {
if (!context.getPackageName().startsWith("com.wireguard."))
throw new SecurityException("The tools may only be installed system-wide from the main WireGuard app.");
return willInstallAsMagiskModule() ? installMagisk() : installSystem();
}