version:1.1.8
fix: update:更新图标,增加sd卡安装
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
|
||||
apply plugin: "com.tencent.android.tpns"
|
||||
|
||||
def appName() {
|
||||
return "ZYAppStore"
|
||||
return "CubeZYAppStore"
|
||||
}
|
||||
|
||||
def releaseTime() {
|
||||
@@ -18,8 +18,8 @@ android {
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 29
|
||||
|
||||
versionCode 5
|
||||
versionName "1.1.3"
|
||||
versionCode 10
|
||||
versionName "1.1.8"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ public class MainActivity extends BaseActivity {
|
||||
Log.e(TAG, "onCreate");
|
||||
startService(new Intent(MainActivity.this, DownloadService.class));
|
||||
starService();
|
||||
JGYUtils.getInstance().checkLocalExternalFiles();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -95,6 +95,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
file.mkdirs();
|
||||
}
|
||||
mPresenter.getSnTag();
|
||||
JGYUtils.getInstance().checkLocalExternalFiles();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -803,10 +803,32 @@ public class ApkUtils {
|
||||
public static HashSet<String> ownApp = new HashSet<String>() {{
|
||||
this.add(BuildConfig.APPLICATION_ID);
|
||||
this.add("com.android.uiuios");
|
||||
this.add("com.safe.uiui");
|
||||
this.add("com.uiuios.aios");
|
||||
this.add("com.uiuios.sn");
|
||||
this.add("com.uiuios.appstore");
|
||||
this.add("com.uiuios.browser");
|
||||
this.add("com.uiui.aios");
|
||||
this.add("com.uiui.sn");
|
||||
this.add("com.uiui.appstore");
|
||||
this.add("com.uiui.browser");
|
||||
this.add("com.aoleyun.os");
|
||||
this.add("com.aoleyun.sn");
|
||||
this.add("com.aoleyun.appstore");
|
||||
this.add("com.aoleyun.browser");
|
||||
this.add("com.aoleyun.info");
|
||||
this.add("com.aoleyunos.dop1");
|
||||
this.add("com.aoleyunos.dop2");
|
||||
this.add("com.aoleyunos.diy");
|
||||
this.add("com.teclast.zyos");
|
||||
this.add("com.teclast.zy");
|
||||
this.add("com.teclast.zyappstore");
|
||||
this.add("com.teclast.zybrowser");
|
||||
this.add("com.uiui.zyos");
|
||||
this.add("com.uiui.zy");
|
||||
this.add("com.uiui.zyappstore");
|
||||
this.add("com.uiui.zybrowser");
|
||||
this.add("com.uiui.zysn");
|
||||
this.add("com.uiui.aios");
|
||||
this.add("com.safe.uiui");
|
||||
this.add("com.uiui.calendar");
|
||||
}};
|
||||
}
|
||||
|
||||
@@ -20,16 +20,29 @@ import android.util.Log;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.blankj.utilcode.util.FileUtils;
|
||||
import com.uiui.zyappstore.BuildConfig;
|
||||
import com.uiui.zyappstore.receiver.BootReceiver;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.core.ObservableEmitter;
|
||||
import io.reactivex.rxjava3.core.ObservableOnSubscribe;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
|
||||
public class JGYUtils {
|
||||
@@ -438,4 +451,123 @@ public class JGYUtils {
|
||||
//true为打开,false为关闭
|
||||
return powerManager.isInteractive();
|
||||
}
|
||||
|
||||
public List<String> externalPkg = new ArrayList<String>() {{
|
||||
this.add("com.aoleyun.appstore");
|
||||
this.add("com.aoleyun.browser");
|
||||
this.add("com.aoleyun.sn");
|
||||
this.add("com.aoleyun.info");
|
||||
|
||||
this.add("com.qi.studycomputer.launcher");
|
||||
this.add("com.wyt.evaluating");
|
||||
this.add("com.qi.childsystem.launcher");
|
||||
this.add("com.qi.TFSystem");
|
||||
this.add("com.yixuetong.user");
|
||||
this.add("com.wyt.tongbuyouxue");
|
||||
this.add("air.wyt.modloader");
|
||||
|
||||
this.add("com.alibaba.android.rimet");
|
||||
this.add("com.tencent.wemeet.app");
|
||||
}};
|
||||
|
||||
private static final String AOLE_DIR = "aole";
|
||||
public HashMap<String, String> mPackageListMap = new HashMap<>();
|
||||
|
||||
public void checkLocalExternalFiles() {
|
||||
File[] externalFiles = mContext.getExternalFilesDirs(null);
|
||||
Log.e(TAG, "checkLocalAppInstall: externalFiles = " + Arrays.toString(externalFiles));
|
||||
|
||||
String SdPath = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||
Log.e(TAG, "checkLocalAppInstall: SdPath = " + SdPath);
|
||||
String aolePath = SdPath + File.separator + AOLE_DIR;
|
||||
File file = new File(aolePath);
|
||||
String[] apkName = file.list();
|
||||
if (apkName == null || apkName.length == 0) {
|
||||
Log.e(TAG, "checkLocalAppInstall: apkName is empty");
|
||||
} else {
|
||||
Observable.create(new ObservableOnSubscribe<HashMap<String, String>>() {
|
||||
@Override
|
||||
public void subscribe(@NonNull ObservableEmitter<HashMap<String, String>> emitter) throws Throwable {
|
||||
HashMap<String, String> packageListMap = new HashMap<>();
|
||||
for (String fileName : apkName) {
|
||||
String apkPath = aolePath + File.separator + fileName;
|
||||
Log.e(TAG, "subscribe: " + apkPath);
|
||||
String pkg = ApkUtils.getPackageName(mContext, apkPath);
|
||||
// if (externalPkg.contains(pkg)) {
|
||||
packageListMap.put(pkg, apkPath);
|
||||
// } else {
|
||||
// Log.e(TAG, "checkLocalAppInstall: skip: " + pkg + " fileName: " + fileName);
|
||||
// }
|
||||
}
|
||||
mPackageListMap = packageListMap;
|
||||
emitter.onNext(packageListMap);
|
||||
}
|
||||
}).subscribe(new Observer<HashMap<String, String>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("checkLocalAppInstall", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull HashMap<String, String> stringStringHashMap) {
|
||||
Log.e("checkLocalAppInstall", "onNext: " + stringStringHashMap);
|
||||
stringStringHashMap.forEach(new BiConsumer<String, String>() {
|
||||
@Override
|
||||
public void accept(String key, String value) {
|
||||
if (ApkUtils.isAvailable(mContext, key)) {
|
||||
Log.e("checkLocalAppInstall", "accept: installed: " + key);
|
||||
} else {
|
||||
// copyFile(value);
|
||||
ApkUtils.installApp(mContext, value);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("checkLocalAppInstall", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("checkLocalAppInstall", "onComplete: ");
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void copyFile(String filePath) {
|
||||
Log.e(TAG, "copyFile: " + filePath);
|
||||
File file = new File(filePath);
|
||||
String fileName = file.getName();
|
||||
String newFilePath = getDownLoadPath() + fileName;
|
||||
File newFile = new File(newFilePath);
|
||||
String fileMD5 = com.blankj.utilcode.util.FileUtils.getFileMD5ToString(file);
|
||||
String newFileMD5 = FileUtils.getFileMD5ToString(newFile);
|
||||
if (newFile.exists()) {
|
||||
if (fileMD5.equals(newFileMD5)) {
|
||||
// AdminManager.getInstance().installPackage(newFilePath);
|
||||
} else {
|
||||
newFile.delete();
|
||||
try {
|
||||
Files.copy(file.toPath(), newFile.toPath());
|
||||
// AdminManager.getInstance().installPackage(newFilePath);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Log.e("Files.copy", "IOException:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
Files.copy(file.toPath(), newFile.toPath());
|
||||
// AdminManager.getInstance().installPackage(newFilePath);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Log.e("Files.copy", "IOException:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.3 KiB |