package com.gary.bootdelkeypassword;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;
import android.os.Environment;
import android.os.Bundle;
import android.os.Handler;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
public class BootDelKeyPassword extends BroadcastReceiver{
private static final String TAG = "BootDelKeyPassword";
private static final String DEL_KEYPWD_COMMAND_INTENT = "com.gary.intent.bootdelkeypassword.BootDelKeyPasswordService";
private Context mContext = null;
@Override
public void onReceive(Context context, Intent intent) {
//try {
if(getAutoDeleteKeyPasswordFlag()){
Intent intent_cmd = new Intent(DEL_KEYPWD_COMMAND_INTENT);
//intent.putExtra(COMMAND_PART2, OTA_PATH_IN_RECOVERY_PRE + strPkgPath);
intent.putExtra("start_type", "response");
context.startService(intent_cmd);
}
//} catch (RemoteException e) {
//e.printStackTrace();
//return ;
//}
}
private boolean getAutoDeleteKeyPasswordFlag() {
//final File[] file = Environment.getExternalStorageDirectory().listFiles();//("/sdcard").listFiles();
final File[] file = new File("/storage/sdcard1").listFiles();//("/mnt/sdcard").listFiles();
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
Log.d(TAG, "getAutoDeleteKeyPasswordFlag mounted");
return false;
}
//if (file ==null)){
//Log.d(TAG, "getAutoDeleteKeyPasswordFlag mounted");
//return false;
//}
Log.d(TAG, "getAutoDeleteKeyPasswordFlag file" +file);
for(int i=0 ; file!= null && i<file.length ;i++) {
Log.d(TAG, "getAutoDeleteKeyPasswordFlag file[i].toString()=" +file[i].toString());
//need delete password key flag
if(file[i].isDirectory()
&&file[i].getName().equals("factory_reset")//file[i].toString().equals("FactoryReset")
&&file[i].list().length<=0) {
Log.d(TAG, "getAutoDeleteKeyPasswordFlag need delete");
file[i].delete();
return true;
}
}
return false;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论


















收起资源包目录






















































共 26 条
- 1
资源评论


架构师训练营
- 粉丝: 1317
- 资源: 6
上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


会员权益专享
安全验证
文档复制为VIP权益,开通VIP直接复制
