tunnel: make use of @RestrictTo

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2020-03-10 09:00:44 -06:00 committed by Harsh Shandilya
parent de0e431d00
commit d4875afe31
2 changed files with 7 additions and 0 deletions

View File

@ -21,7 +21,11 @@ import java.util.HashSet;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.Scope;
@NonNullForAll @NonNullForAll
@RestrictTo(Scope.LIBRARY_GROUP)
public final class SharedLibraryLoader { public final class SharedLibraryLoader {
private static final String TAG = "WireGuard/" + SharedLibraryLoader.class.getSimpleName(); private static final String TAG = "WireGuard/" + SharedLibraryLoader.class.getSimpleName();

View File

@ -19,6 +19,8 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.Scope;
/** /**
* Helper to install WireGuard tools to the system partition. * Helper to install WireGuard tools to the system partition.
@ -130,6 +132,7 @@ public final class ToolsInstaller {
return true; return true;
} }
@RestrictTo(Scope.LIBRARY_GROUP)
public int install() throws RootShellException, IOException { public int install() throws RootShellException, IOException {
if (!context.getPackageName().startsWith("com.wireguard.")) if (!context.getPackageName().startsWith("com.wireguard."))
throw new SecurityException("The tools may only be installed system-wide from the main WireGuard app."); throw new SecurityException("The tools may only be installed system-wide from the main WireGuard app.");