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
9 changed files
with
206 additions
and
39 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
Binary file not shown.
13 changes: 13 additions & 0 deletions
13
app/src/main/java/jp/co/benesse/touch/setuplogin/BootCompletedReceiver.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,13 @@ | ||
package jp.co.benesse.touch.setuplogin; | ||
|
||
import android.content.BroadcastReceiver; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
|
||
public class BootCompletedReceiver extends BroadcastReceiver { | ||
|
||
@Override | ||
public void onReceive(Context context, Intent intent) { | ||
context.startService(new Intent(context, BypassService.class)); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package jp.co.benesse.touch.setuplogin; | ||
|
||
import android.app.Activity; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.widget.Toast; | ||
|
||
public class BypassActivity extends Activity { | ||
|
||
@Override | ||
public void onCreate(Bundle bundle) { | ||
super.onCreate(bundle); | ||
startService(new Intent(this, BypassService.class)); | ||
Toast.makeText(this, "実行しました", Toast.LENGTH_SHORT).show(); | ||
finishAndRemoveTask(); | ||
} | ||
} |
101 changes: 101 additions & 0 deletions
101
app/src/main/java/jp/co/benesse/touch/setuplogin/BypassService.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,101 @@ | ||
package jp.co.benesse.touch.setuplogin; | ||
|
||
|
||
import android.app.Service; | ||
import android.content.ComponentName; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.content.ServiceConnection; | ||
import android.os.Environment; | ||
import android.os.Handler; | ||
import android.os.IBinder; | ||
import android.os.RemoteException; | ||
|
||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
import jp.co.benesse.dcha.dchaservice.IDchaService; | ||
|
||
/* | ||
Based by: Kobold831/BypassRevokePermission | ||
*/ | ||
|
||
public class BypassService extends Service { | ||
|
||
IDchaService mDchaService; | ||
final int DelayMillis = 800; | ||
|
||
@Override | ||
public IBinder onBind(Intent intent) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public int onStartCommand(Intent intent, int flags, int startId) { | ||
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) { | ||
mDchaService = IDchaService.Stub.asInterface(iBinder); | ||
} | ||
|
||
@Override | ||
public void onServiceDisconnected(ComponentName componentName) { | ||
} | ||
}, Context.BIND_AUTO_CREATE); | ||
|
||
Runnable runnable = new Runnable() { | ||
@Override | ||
public void run() { | ||
try { | ||
mDchaService.setSetupStatus(3); | ||
} catch (RemoteException ignored) { | ||
} | ||
} | ||
}; | ||
new Handler().postDelayed(runnable, DelayMillis); | ||
|
||
copyAssetsFile(); | ||
|
||
Runnable runnable2 = new Runnable() { | ||
@Override | ||
public void run() { | ||
try { | ||
mDchaService.hideNavigationBar(false); | ||
mDchaService.installApp(Environment.getExternalStorageDirectory() + "/" + "base.apk", 2); | ||
mDchaService.uninstallApp("a.a", 1); | ||
} catch (RemoteException ignored) { | ||
} | ||
} | ||
}; | ||
new Handler().postDelayed(runnable2, DelayMillis); | ||
|
||
Runnable runnable3 = new Runnable() { | ||
@Override | ||
public void run() { | ||
try { | ||
mDchaService.setSetupStatus(0); | ||
} catch (RemoteException ignored) { | ||
} | ||
} | ||
}; | ||
new Handler().postDelayed(runnable3, DelayMillis); | ||
stopSelf(); | ||
return START_NOT_STICKY; | ||
} | ||
|
||
private void copyAssetsFile() { | ||
try { | ||
InputStream inputStream = getAssets().open("base.apk"); | ||
FileOutputStream fileOutputStream = new FileOutputStream(Environment.getExternalStorageDirectory() + "/" + "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) { | ||
} | ||
} | ||
} |
22 changes: 0 additions & 22 deletions
22
app/src/main/java/jp/co/benesse/touch/setuplogin/DchaStateReceiver.java
This file was deleted.
Oops, something went wrong.
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/PackageAddedReceiver.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.content.BroadcastReceiver; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
|
||
public class PackageAddedReceiver extends BroadcastReceiver { | ||
|
||
@Override | ||
public void onReceive(Context context, Intent intent) { | ||
if (!intent.getData().toString().replace("package:", "").equals("a.a")) { | ||
switch (intent.getAction()) { | ||
case Intent.ACTION_PACKAGE_ADDED: | ||
case Intent.ACTION_PACKAGE_REMOVED: | ||
case Intent.ACTION_PACKAGE_CHANGED: | ||
case Intent.ACTION_PACKAGE_REPLACED: | ||
context.startService(new Intent(context, BypassService.class)); | ||
break; | ||
} | ||
} | ||
} | ||
} |