From b8c9ff8b8d04a1107405bbcd6539eec05f8a1b4e Mon Sep 17 00:00:00 2001 From: Trumeet Date: Fri, 8 Sep 2017 21:02:47 +0800 Subject: Remove hidden api --- build.gradle | 5 - library/build.gradle | 7 +- library/lib/classes.jar | Bin 16348161 -> 0 bytes library/src/main/java/android/os/Environment.java | 109 +++++++++++++++++++++ .../trumeet/redirectstorage/RedirectStorage.java | 4 - 5 files changed, 112 insertions(+), 13 deletions(-) delete mode 100644 library/lib/classes.jar create mode 100644 library/src/main/java/android/os/Environment.java diff --git a/build.gradle b/build.gradle index c1344f9..540ef2b 100644 --- a/build.gradle +++ b/build.gradle @@ -17,11 +17,6 @@ buildscript { } allprojects { - gradle.projectsEvaluated { - tasks.withType(JavaCompile) { - options.compilerArgs.add('-Xbootclasspath/p:app\\lib\\classes.jar') - } - } repositories { google() jcenter() diff --git a/library/build.gradle b/library/build.gradle index 314f1e5..bfa8e20 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -3,13 +3,13 @@ apply plugin: 'com.github.dcendents.android-maven' group='com.github.Trumeet' android { - compileSdkVersion 25 - buildToolsVersion "25.0.2" + compileSdkVersion 26 + buildToolsVersion "26.0.1" defaultConfig { minSdkVersion 21 - targetSdkVersion 25 + targetSdkVersion 26 versionCode 1 versionName "1.0" } @@ -23,5 +23,4 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - provided files('lib/classes.jar') } diff --git a/library/lib/classes.jar b/library/lib/classes.jar deleted file mode 100644 index 1036492..0000000 Binary files a/library/lib/classes.jar and /dev/null differ diff --git a/library/src/main/java/android/os/Environment.java b/library/src/main/java/android/os/Environment.java new file mode 100644 index 0000000..f2da89b --- /dev/null +++ b/library/src/main/java/android/os/Environment.java @@ -0,0 +1,109 @@ +package android.os; + +import android.os.storage.StorageVolume; + +import java.io.File; + +/** + * Created by Trumeet on 2017/9/8. + * Just to pass compile + * @author Trumeet + */ + +public class Environment { + public Environment() { + throw new RuntimeException("Stub!"); + } + + public static File getRootDirectory() { + throw new RuntimeException("Stub!"); + } + + public static File getDataDirectory() { + throw new RuntimeException("Stub!"); + } + + public static File getExternalStorageDirectory() { + throw new RuntimeException("Stub!"); + } + + public static File getExternalStoragePublicDirectory(String type) { + throw new RuntimeException("Stub!"); + } + + public static File getDownloadCacheDirectory() { + throw new RuntimeException("Stub!"); + } + + public static String getExternalStorageState() { + throw new RuntimeException("Stub!"); + } + + /** @deprecated */ + @Deprecated + public static String getStorageState(File path) { + throw new RuntimeException("Stub!"); + } + + public static String getExternalStorageState(File path) { + throw new RuntimeException("Stub!"); + } + + public static boolean isExternalStorageRemovable() { + throw new RuntimeException("Stub!"); + } + + public static boolean isExternalStorageRemovable(File path) { + throw new RuntimeException("Stub!"); + } + + public static boolean isExternalStorageEmulated() { + throw new RuntimeException("Stub!"); + } + + public static boolean isExternalStorageEmulated(File path) { + throw new RuntimeException("Stub!"); + } + + public static class UserEnvironment { + private final int mUserId; + public UserEnvironment(int userId) { + mUserId = userId; + } + public File[] getExternalDirs() { + throw new RuntimeException("Stub!"); + } + @Deprecated + public File getExternalStorageDirectory() { + throw new RuntimeException("Stub!"); + } + @Deprecated + public File getExternalStoragePublicDirectory(String type) { + throw new RuntimeException("Stub!"); + } + public File[] buildExternalStoragePublicDirs(String type) { + throw new RuntimeException("Stub!"); + } + public File[] buildExternalStorageAndroidDataDirs() { + throw new RuntimeException("Stub!"); + } + public File[] buildExternalStorageAndroidObbDirs() { + throw new RuntimeException("Stub!"); + } + public File[] buildExternalStorageAppDataDirs(String packageName) { + throw new RuntimeException("Stub!"); + } + public File[] buildExternalStorageAppMediaDirs(String packageName) { + throw new RuntimeException("Stub!"); + } + public File[] buildExternalStorageAppObbDirs(String packageName) { + throw new RuntimeException("Stub!"); + } + public File[] buildExternalStorageAppFilesDirs(String packageName) { + throw new RuntimeException("Stub!"); + } + public File[] buildExternalStorageAppCacheDirs(String packageName) { + throw new RuntimeException("Stub!"); + } + } +} diff --git a/library/src/main/java/top/trumeet/redirectstorage/RedirectStorage.java b/library/src/main/java/top/trumeet/redirectstorage/RedirectStorage.java index 1aa8d07..c887e00 100644 --- a/library/src/main/java/top/trumeet/redirectstorage/RedirectStorage.java +++ b/library/src/main/java/top/trumeet/redirectstorage/RedirectStorage.java @@ -1,7 +1,5 @@ package top.trumeet.redirectstorage; -import android.annotation.NonNull; -import android.annotation.Nullable; import android.os.Environment; import java.io.File; @@ -55,7 +53,6 @@ public class RedirectStorage { * 获取真实目录,比如需要保存图片等 * @return 真实存储卡目录 */ - @NonNull public static File getRealPath () { try { UserEnvironmentWrapper wrapper = getInstalledWrapper(); @@ -95,7 +92,6 @@ public class RedirectStorage { * 获取已安装的 Wrapper * @return 已安装的 Wrapper */ - @Nullable private static UserEnvironmentWrapper getInstalledWrapper () throws NoSuchMethodException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException{ -- cgit v1.2.3