Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
調整
Browse files Browse the repository at this point in the history
  • Loading branch information
s1204IT committed Mar 1, 2024
1 parent b01f680 commit ae897dd
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 29 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@
/CT?/build/
# Android Studio Signing APK
/app/release/
/CT?/release/
/CT?/release/
# Bundled APK
/app/src/main/assets/*.apk
1 change: 1 addition & 0 deletions CT3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ android {
minifyEnabled false
}
release {
signingConfig signingConfigs.android
minifyEnabled true
shrinkResources true
}
Expand Down
1 change: 1 addition & 0 deletions CTX/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ android {
minifyEnabled false
}
release {
signingConfig signingConfigs.android
minifyEnabled true
shrinkResources true
}
Expand Down
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ android {
minifyEnabled false
}
release {
signingConfig signingConfigs.android
minifyEnabled true
shrinkResources true
}
Expand Down
4 changes: 1 addition & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
tools:ignore="ProtectedPermissions">

<uses-permission android:name="jp.co.benesse.dcha.permission.ACCESS_SYSTEM" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.REBOOT" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
android:label="App Direct Installer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@ public class LoginSettingActivity extends Activity {

IDchaService mDchaService;

// Based by Kobold831
private String copyAssetsFile(String model) throws IOException{
// TODO: 機能修正
private String copyAssetsFile(String model) throws IOException {
final String ASSET_APK = model + APK_EXT;
final String APK_PATH = getApplicationContext().getFilesDir().getPath() + "/" + ASSET_APK;
InputStream inputStream = getApplicationContext().getAssets().open(ASSET_APK);
FileOutputStream fileOutputStream = new FileOutputStream(APK_PATH, false);
InputStream inputStream = getAssets().open(ASSET_APK);
FileOutputStream fileOutputStream = openFileOutput(ASSET_APK, MODE_PRIVATE);
byte[] buffer = new byte[1024];
int length;
while ((length = inputStream.read(buffer)) >= 0) {
fileOutputStream.write(buffer, 0, length);
}
fileOutputStream.close();
inputStream.close();
return APK_PATH;
return getFilesDir() + ASSET_APK;
}

@Deprecated
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -54,21 +54,16 @@ protected void onCreate(Bundle savedInstanceState) {
final String BC_PASSWORD_HIT_FLAG = "bc_password_hit";
final int PASSWORD_FLAG = 1;
final int UNDIGICHALIZE = 0;
final int DIGICHALIZING_DL_COMPLETE = 2;
final int DIGICHALIZED = 3;
final int INSTALL_FLAG = 2;
final int UNINSTALL_FLAG = 1;
final int REBOOT_DEVICE = 0;
final String DSW_PACKAGE = "jp.co.benesse.dcha.setupwizard";
final String DSS_PACKAGE = "jp.co.benesse.dcha.systemsettings";
final String DSS_ACTIVITY = DSS_PACKAGE + ".TabletInfoSettingActivity";
final String LAUNCHER2 = "com.android.launcher2";
final String LAUNCHER3 = "com.android.launcher3";
final String CUSTOMIZE_TOOL = "com.saradabar.cpadcustomizetool";
final String KOBOLD_STORE = "com.saradabar.vending";

// DchaSystemSettings を呼び出し
startActivity(new Intent().setClassName(DSS_PACKAGE, DSS_ACTIVITY));
// (ループ)プログレスバー実装 //
// 再起動時にADBの状態を保持する
Settings.System.putInt(getContentResolver(), BC_PASSWORD_HIT_FLAG, PASSWORD_FLAG);

Expand All @@ -84,24 +79,23 @@ public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
mDchaService.hideNavigationBar(false);

// インストール部分 //
// CT2はバイパス必須
//mDchaService.installApp(copyAssetsFile("ALL"), INSTALL_FLAG);
mDchaService.installApp("/sdcard/ALL.apk", INSTALL_FLAG);
if (CT_MODEL.equals(CT3) && !Build.ID.startsWith("01")) {
mDchaService.installApp(copyAssetsFile("CT3"), INSTALL_FLAG);
} else if (CT_MODEL.equals(CTX) || CT_MODEL.equals(CTZ)) {
mDchaService.installApp(copyAssetsFile("CTX"), INSTALL_FLAG);
}

// Launcher3 の関連付けを解除
// 規定ランチャーの関連付けを解除
mDchaService.clearDefaultPreferredApp(LAUNCHER2);
mDchaService.clearDefaultPreferredApp(LAUNCHER3);
// 既定のランチャーを変更 (CTX/Z のみ機能)
mDchaService.setDefaultPreferredHomeApp(KOBOLD_STORE);
// DchaSetupWizard をタスクキル
mDchaService.removeTask(DSW_PACKAGE);
// 再起動
mDchaService.rebootPad(REBOOT_DEVICE, null);
// このアプリを削除
mDchaService.uninstallApp(getPackageName(), UNINSTALL_FLAG);
// 自己アンインストール
mDchaService.uninstallApp(getPackageName(), INSTALL_FLAG+1);
} catch (RemoteException | IOException ignored) {
}
unbindService(this);
Expand Down
8 changes: 1 addition & 7 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@
> [!NOTE]
> 現在、移行作業中!
TODO:

- [ ] CT2のAPKすり替えの実装
- [ ] ループプログレスバーを実装
- [ ] ストアアプリを実装

---

SDカードから [**CPad Customize Tool**](https://github.com/Kobold831/CPadCustomizeTool)[**Nova Launcher**](https://novalauncher.com)等のアプリをインストールするためのアプリです。
[**CPad Customize Tool**](https://github.com/Kobold831/CPadCustomizeTool)[**Nova Launcher**](https://novalauncher.com)等のアプリをインストールするためのアプリです。

[![Build](https://github.com/s1204IT/NovaDirectInstaller/actions/workflows/build.yml/badge.svg?branch=main&event=push)](https://github.com/s1204IT/NovaDirectInstaller/actions/workflows/build.yml)

Expand Down

0 comments on commit ae897dd

Please sign in to comment.