This repository has been archived by the owner on Jun 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
263 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
-keep class ** | ||
-keep class jp.co.benesse.dcha.dchaservice.IDchaService |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 80 additions & 1 deletion
81
app/src/main/java/jp/co/benesse/touch/setuplogin/BypassActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,96 @@ | ||
package jp.co.benesse.touch.setuplogin; | ||
|
||
/* | ||
Based by: Kobold831/BypassRevokePermission | ||
*/ | ||
|
||
import android.app.Activity; | ||
import android.app.ActivityManager; | ||
import android.content.ComponentName; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.content.ServiceConnection; | ||
import android.os.BenesseExtension; | ||
import android.os.Bundle; | ||
import android.os.Handler; | ||
import android.os.IBinder; | ||
import android.widget.Toast; | ||
|
||
import java.io.File; | ||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
import jp.co.benesse.dcha.dchaservice.IDchaService; | ||
|
||
public class BypassActivity extends Activity { | ||
|
||
@Override | ||
public void onCreate(Bundle bundle) { | ||
super.onCreate(bundle); | ||
startService(new Intent(this, BypassService.class)); | ||
run(this); | ||
Toast.makeText(this, "実行しました", Toast.LENGTH_SHORT).show(); | ||
finishAndRemoveTask(); | ||
} | ||
|
||
public static void run(final Context context) { | ||
BenesseExtension.setDchaState(3); | ||
copyAssetsFile(context); | ||
context.bindService(new Intent("jp.co.benesse.dcha.dchaservice.DchaService").setPackage("jp.co.benesse.dcha.dchaservice"), new ServiceConnection() { | ||
@Override | ||
public void onServiceConnected(ComponentName componentName, IBinder iBinder) { | ||
IDchaService mDchaService = IDchaService.Stub.asInterface(iBinder); | ||
try { | ||
mDchaService.hideNavigationBar(false); | ||
mDchaService.installApp(context.getExternalFilesDir("") + "/" + "base.apk", 2); | ||
mDchaService.uninstallApp("a.a", 1); | ||
} catch (Exception ignored) { | ||
} | ||
context.unbindService(this); | ||
} | ||
|
||
@Override | ||
public void onServiceDisconnected(ComponentName componentName) { | ||
} | ||
}, Context.BIND_AUTO_CREATE); | ||
|
||
Runnable runnable = new Runnable() { | ||
@Override | ||
public void run() { | ||
BenesseExtension.setDchaState(0); | ||
} | ||
}; | ||
new Handler().postDelayed(runnable, 800); | ||
|
||
if (!isActiveBypassService(context)) { | ||
context.startService(new Intent(context, BypassService.class)); | ||
} | ||
} | ||
|
||
public static void copyAssetsFile(Context context) { | ||
try { | ||
if (new File(context.getExternalFilesDir("") + "/" + "base.apk").exists()) { | ||
return; | ||
} | ||
InputStream inputStream = context.getAssets().open("base.apk"); | ||
FileOutputStream fileOutputStream = new FileOutputStream(context.getExternalFilesDir("") + "/" + "base.apk", false); | ||
byte[] buffer = new byte[1024]; | ||
int length; | ||
while ((length = inputStream.read(buffer)) >= 0) { | ||
fileOutputStream.write(buffer, 0, length); | ||
} | ||
fileOutputStream.close(); | ||
inputStream.close(); | ||
} catch (IOException ignored) { | ||
} | ||
} | ||
|
||
public static boolean isActiveBypassService(Context context) { | ||
for (ActivityManager.RunningServiceInfo serviceInfo : ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE)).getRunningServices(Integer.MAX_VALUE)) { | ||
if (BypassService.class.getName().equals(serviceInfo.service.getClassName())) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
app/src/main/java/jp/co/benesse/touch/setuplogin/DchaStateReceiver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package jp.co.benesse.touch.setuplogin; | ||
|
||
import android.annotation.SuppressLint; | ||
import android.content.BroadcastReceiver; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import static android.os.BenesseExtension.setDchaState; | ||
import static android.provider.Settings.System.canWrite; | ||
import static android.provider.Settings.System.putInt; | ||
|
||
public class DchaStateReceiver extends BroadcastReceiver { | ||
@SuppressLint("UnsafeProtectedBroadcastReceiver") | ||
public void onReceive(Context c, Intent i) { | ||
setDchaState(3); | ||
if (canWrite(c)) { | ||
// ナビバーを表示 | ||
putInt(c.getContentResolver(), "hide_navigation_bar", 0); | ||
// スクリーンショットを有効化 | ||
putInt(c.getContentResolver(), "allow_screen_shot", 1); | ||
} | ||
} | ||
} |
Oops, something went wrong.