【读取手机根目录文件并轮询启动action】

    
                try {
//                    String filename = "/sdcard/ansi1.txt";
                    List<String> actions = new ArrayList<String>();
                    File filename = new File(Environment.getExternalStorageDirectory(),
                            "ScreensToDisable.txt");
                    BufferedReader br = new BufferedReader(new FileReader(filename));
                    String readline = "";
                    StringBuffer sb = new StringBuffer();
                    while ((readline = br.readLine()) != null) {
//                        System.out.println("readline:" + readline);
                        sb.append(readline);
                        Matcher m =Pattern.compile("android.settings.\\S+").matcher(readline);
                        while (m.find()){
                            String tmp_str = m.group();
                            tmp_str = tmp_str.substring(0,tmp_str.length()-2);
//                            System.out.println("find():'"+tmp_str+"' start ="+m.start()+" " +
//                                    "end= "+m.end());
                            actions.add(tmp_str);
                        }
                    }
                    br.close();
//                    Log.d(TAG,"读取成功"+sb.toString());

                    for(String action:actions){
//                        System.out.println("获得自己想要的action:"+action);

                        Intent intent = new Intent();
                        intent.setAction(action);
                        Log.d(TAG,"start this action:"+action);

                        try{
                            startActivity(intent);
                            Thread.sleep(2000);
                        }catch (InterruptedException  | ActivityNotFoundException e) {

                            e.printStackTrace();
                        }

                    }
//                    // 使用编码格式获得内容
//                    txt = EncodingUtils.getString(buffer, type);
//                    textView.setText(txt);
                } catch(IOException   e) {
                    // TODO: handle exception
                    e.printStackTrace();
                }
AndroidManifest.xml文件中的权限声明
 <uses-permission android:name="android.permission.TETHER_PRIVILEGED" />
    <uses-permission android:name="android.permission.MANAGE_USERS" />


    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />

执行说明:
public static final String ACTION_TETHER_PROVISIONING = "android.settings.TETHER_PROVISIONING_UI";
public static final String ACTION_SYSTEM_UPDATE_SETTINGS =        "android.settings.SYSTEM_UPDATE_SETTINGS";
public static final String ACTION_APP_OPS_SETTINGS =        "android.settings.APP_OPS_SETTINGS";
public static final String ACTION_MANAGED_PROFILE_SETTINGS =        "android.settings.MANAGED_PROFILE_SETTINGS";
public static final String ACTION_STORAGE_MANAGER_SETTINGS = "android.settings.STORAGE_MANAGER_SETTINGS";  A50返回没有权限
public static final String ACTION_PRIVACY_SETTINGS =        "android.settings.PRIVACY_SETTINGS"; A50会导致系统设置崩溃
 
public static final String ACTION_NFC_PAYMENT_SETTINGS =    "android.settings.NFC_PAYMENT_SETTINGS";

在这里插入图片描述
数据:

public static final String ACTION_SETTINGS = "android.settings.SETTINGS";
public static final String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS";
public static final String ACTION_LOCATION_SOURCE_SETTINGS ="android.settings.LOCATION_SOURCE_SETTINGS";
public static final String ACTION_LOCATION_SCANNING_SETTINGS ="android.settings.LOCATION_SCANNING_SETTINGS";
public static final String ACTION_USER_SETTINGS ="android.settings.USER_SETTINGS";
public static final String ACTION_AIRPLANE_MODE_SETTINGS = "android.settings.AIRPLANE_MODE_SETTINGS";
public static final String ACTION_MOBILE_DATA_USAGE =        "android.settings.MOBILE_DATA_USAGE";
public static final String ACTION_VOICE_CONTROL_AIRPLANE_MODE =        "android.settings.VOICE_CONTROL_AIRPLANE_MODE";
public static final String ACTION_ACCESSIBILITY_SETTINGS =        "android.settings.ACCESSIBILITY_SETTINGS";
public static final String ACTION_USAGE_ACCESS_SETTINGS =        "android.settings.USAGE_ACCESS_SETTINGS";
public static final String INTENT_CATEGORY_USAGE_ACCESS_CONFIG =        "android.intent.category.USAGE_ACCESS_CONFIG";
public static final String METADATA_USAGE_ACCESS_REASON =        "android.settings.metadata.USAGE_ACCESS_REASON";
public static final String ACTION_SECURITY_SETTINGS =        "android.settings.SECURITY_SETTINGS";
public static final String ACTION_MANAGE_UNKNOWN_APP_SOURCES =        "android.settings.MANAGE_UNKNOWN_APP_SOURCES";
public static final String ACTION_TRUSTED_CREDENTIALS_USER =        "com.android.settings.TRUSTED_CREDENTIALS_USER";
public static final String ACTION_MONITORING_CERT_INFO =        "com.android.settings.MONITORING_CERT_INFO";
public static final String ACTION_PRIVACY_SETTINGS =        "android.settings.PRIVACY_SETTINGS";
public static final String ACTION_VPN_SETTINGS =        "android.settings.VPN_SETTINGS";
public static final String ACTION_DATA_USAGE_SETTINGS =        "android.settings.DATA_USAGE_SETTINGS";
public static final String ACTION_BLUETOOTH_SETTINGS =        "android.settings.BLUETOOTH_SETTINGS";
public static final String ACTION_ASSIST_GESTURE_SETTINGS =        "android.settings.ASSIST_GESTURE_SETTINGS";
public static final String ACTION_FINGERPRINT_ENROLL =        "android.settings.FINGERPRINT_ENROLL";
public static final String ACTION_CAST_SETTINGS =        "android.settings.CAST_SETTINGS";
public static final String ACTION_DATE_SETTINGS =        "android.settings.DATE_SETTINGS";
public static final String ACTION_SOUND_SETTINGS =        "android.settings.SOUND_SETTINGS";
public static final String ACTION_DISPLAY_SETTINGS =        "android.settings.DISPLAY_SETTINGS";
public static final String ACTION_LOCALE_SETTINGS =        "android.settings.LOCALE_SETTINGS";
public static final String ACTION_VOICE_INPUT_SETTINGS =        "android.settings.VOICE_INPUT_SETTINGS";
public static final String ACTION_INPUT_METHOD_SETTINGS =        "android.settings.INPUT_METHOD_SETTINGS";
public static final String ACTION_INPUT_METHOD_SUBTYPE_SETTINGS =        "android.settings.INPUT_METHOD_SUBTYPE_SETTINGS";
public static final String ACTION_USER_DICTIONARY_SETTINGS =        "android.settings.USER_DICTIONARY_SETTINGS";
public static final String ACTION_HARD_KEYBOARD_SETTINGS =        "android.settings.HARD_KEYBOARD_SETTINGS";
public static final String ACTION_APPLICATION_SETTINGS =        "android.settings.APPLICATION_SETTINGS";
public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS =        "android.settings.APPLICATION_DEVELOPMENT_SETTINGS";
public static final String ACTION_QUICK_LAUNCH_SETTINGS =        "android.settings.QUICK_LAUNCH_SETTINGS";
public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS =        "android.settings.MANAGE_APPLICATIONS_SETTINGS";
public static final String ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS =        "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS";
public static final String ACTION_MANAGE_OVERLAY_PERMISSION =        "android.settings.action.MANAGE_OVERLAY_PERMISSION";
public static final String ACTION_MANAGE_WRITE_SETTINGS =        "android.settings.action.MANAGE_WRITE_SETTINGS";
public static final String ACTION_APPLICATION_DETAILS_SETTINGS =        "android.settings.APPLICATION_DETAILS_SETTINGS";
public static final String ACTION_FOREGROUND_SERVICES_SETTINGS =        "android.settings.FOREGROUND_SERVICES_SETTINGS";
public static final String ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS =        "android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS";
public static final String ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS =        "android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS";
public static final String ACTION_SYNC_SETTINGS =        "android.settings.SYNC_SETTINGS";
public static final String ACTION_ADD_ACCOUNT =        "android.settings.ADD_ACCOUNT_SETTINGS";
public static final String ACTION_NETWORK_OPERATOR_SETTINGS =        "android.settings.NETWORK_OPERATOR_SETTINGS";
public static final String ACTION_DATA_ROAMING_SETTINGS =        "android.settings.DATA_ROAMING_SETTINGS";
public static final String ACTION_INTERNAL_STORAGE_SETTINGS =        "android.settings.INTERNAL_STORAGE_SETTINGS";
public static final String ACTION_MEMORY_CARD_SETTINGS =        "android.settings.MEMORY_CARD_SETTINGS";
public static final String ACTION_SEARCH_SETTINGS =    "android.search.action.SEARCH_SETTINGS";
public static final String ACTION_DEVICE_INFO_SETTINGS =    "android.settings.DEVICE_INFO_SETTINGS";
public static final String ACTION_NFC_SETTINGS = "android.settings.NFC_SETTINGS";
public static final String ACTION_NFCSHARING_SETTINGS =    "android.settings.NFCSHARING_SETTINGS";
public static final String ACTION_NFC_PAYMENT_SETTINGS =    "android.settings.NFC_PAYMENT_SETTINGS";
public static final String ACTION_DREAM_SETTINGS = "android.settings.DREAM_SETTINGS";
public static final String ACTION_NOTIFICATION_LISTENER_SETTINGS        = "android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS";
public static final String ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS        = "android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS";
public static final String ACTION_CONDITION_PROVIDER_SETTINGS        = "android.settings.ACTION_CONDITION_PROVIDER_SETTINGS";
public static final String ACTION_CAPTIONING_SETTINGS = "android.settings.CAPTIONING_SETTINGS";
public static final String ACTION_PRINT_SETTINGS =        "android.settings.ACTION_PRINT_SETTINGS”;
public static final String  ACTION_SHOW_REGULATORY_INFO = "android.settings.SHOW_REGULATORY_INFO";
public static final String DEVICE_NAME_SETTINGS = "android.settings.DEVICE_NAME";
public static final String ACTION_PAIRING_SETTINGS = "android.settings.PAIRING_SETTINGS";
public static final String ACTION_HOME_SETTINGS  = "android.settings.HOME_SETTINGS";
public static final String ACTION_MANAGE_DEFAULT_APPS_SETTINGS = "android.settings.MANAGE_DEFAULT_APPS_SETTINGS";
public static final String ACTION_NOTIFICATION_SETTINGS   = "android.settings.NOTIFICATION_SETTINGS";
public static final String ACTION_ALL_APPS_NOTIFICATION_SETTINGS = "android.settings.ALL_APPS_NOTIFICATION_SETTINGS";
public static final String ACTION_APP_NOTIFICATION_SETTINGS   = "android.settings.APP_NOTIFICATION_SETTINGS";
public static final String ACTION_CHANNEL_NOTIFICATION_SETTINGS  = "android.settings.CHANNEL_NOTIFICATION_SETTINGS";
public static final String ACTION_APP_NOTIFICATION_REDACTION   = "android.settings.ACTION_APP_NOTIFICATION_REDACTION";
public static final String ACTION_SHOW_ADMIN_SUPPORT_DETAILS = "android.settings.SHOW_ADMIN_SUPPORT_DETAILS";
public static final String ACTION_PICTURE_IN_PICTURE_SETTINGS  = "android.settings.PICTURE_IN_PICTURE_SETTINGS";
public static final String ACTION_WEBVIEW_SETTINGS = "android.settings.WEBVIEW_SETTINGS";
public static final String ACTION_ENTERPRISE_PRIVACY_SETTINGS = "android.settings.ENTERPRISE_PRIVACY_SETTINGS";
public static final String ACTION_REQUEST_SET_AUTOFILL_SERVICE ="android.settings.REQUEST_SET_AUTOFILL_SERVICE";
public static final String ACTION_STORAGE_VOLUME_ACCESS_SETTINGS ="android.settings.STORAGE_VOLUME_ACCESS_SETTINGS";
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值