其他分享
首页 > 其他分享> > android 10 怎样才能拿到多个权限,试了不 行

android 10 怎样才能拿到多个权限,试了不 行

作者:互联网

/*
* Copyright 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.example.android.basicpermissions;

import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.NonNull;
import com.google.android.material.snackbar.Snackbar;

import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.app.ActivityCompat;
import androidx.appcompat.app.AppCompatActivity;

import android.provider.Settings;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;

import androidx.fragment.app.Fragment;

import com.example.android.basicpermissions.camera.CameraPreviewActivity;

/**
 * Launcher Activity that demonstrates the use of runtime permissions for Android M.
 * This Activity requests permissions to access the camera
 * ({@link android.Manifest.permission#CAMERA})
 * when the 'Show Camera Preview' button is clicked to start  {@link CameraPreviewActivity} once
 * the permission has been granted.
 * <p>
 * First, the status of the Camera permission is checked using {@link
 * ActivityCompat#checkSelfPermission(Context, String)}
 * If it has not been granted ({@link PackageManager#PERMISSION_GRANTED}), it is requested by
 * calling
 * {@link ActivityCompat#requestPermissions(Activity, String[], int)}. The result of the request is
 * returned to the
 * {@link androidx.core.app.ActivityCompat.OnRequestPermissionsResultCallback}, which starts
 * {@link
 * CameraPreviewActivity} if the permission has been granted.
 * <p>
 * Note that there is no need to check the API level, the support library
 * already takes care of this. Similar helper methods for permissions are also available in
 * ({@link ActivityCompat},
 * {@link androidx.core.content.ContextCompat} and {@link Fragment}).
 */
public class MainActivity extends AppCompatActivity implements ActivityCompat.OnRequestPermissionsResultCallback {


    private static final int PERMISSION_REQUEST_CAMERA = 0;
//    private static final int     ENDV_WRITE_USER_DICTIONARY     =     1    ;
//    private static final int     ENDV_WRITE_SYNC_SETTINGS     =     2    ;
//    private static final int     ENDV_WRITE_SOCIAL_STREAM     =     3    ;
//    private static final int     ENDV_WRITE_SMS     =     4    ;
//    private static final int     ENDV_WRITE_SETTINGS     =     5    ;
//    private static final int     ENDV_WRITE_SECURE_SETTINGS     =     6    ;
//    private static final int     ENDV_WRITE_PROFILE     =     7    ;
//    private static final int     ENDV_RITE_HISTORY_BOOKMARKS     =     8    ;
//    private static final int     ENDV_WRITE_GSERVICES     =     9    ;
//    private static final int     ENDV_WRITE_EXTERNAL_STORAGE     =     10    ;
//    private static final int     ENDV_WRITE_CONTACTS     =     11    ;
//    private static final int     ENDV_WRITE_CALL_LOG     =     12    ;
//    private static final int     ENDV_WRITE_CALENDAR     =     13    ;
//    private static final int     ENDV_WRITE_APN_SETTINGS     =     14    ;
//    private static final int     ENDV_WAKE_LOCK     =     15    ;
//    private static final int     ENDV_VIBRATE     =     16    ;
//    private static final int     ENDV_USE_SIP     =     17    ;
//    private static final int     ENDV_USE_CREDENTIALS     =     18    ;
//    private static final int     ENDV_UPDATE_DEVICE_STATS     =     19    ;
//    private static final int     ENDV_UNINSTALL_SHORTCUT     =     20    ;
//    private static final int     ENDV_TRANSMIT_IR     =     21    ;
//    private static final int     ENDV_SYSTEM_ALERT_WINDOW     =     22    ;
//    private static final int     ENDV_STATUS_BAR     =     22    ;
//    private static final int     ENDV_SUBSCRIBED_FEEDS_WRITE     =     23    ;
//    private static final int     ENDV_SIGNAL_PERSISTENT_PROCESSES     =     23    ;
//    private static final int     ENDV_SUBSCRIBED_FEEDS_READ     =     24    ;
//    private static final int     ENDV_SET_WALLPAPER_HINTS     =     24    ;
//    private static final int     ENDV_SET_WALLPAPER     =     25    ;
//    private static final int     ENDV_SET_TIME_ZONE     =     26    ;
//    private static final int     ENDV_SET_TIME     =     27    ;
//    private static final int     ENDV_SET_PROCESS_LIMIT     =     28    ;
//    private static final int     ENDV_SET_PREFERRED_APPLICATIONS     =     29    ;
//    private static final int     ENDV_SET_POINTER_SPEED     =     30    ;
//    private static final int     ENDV_SET_ORIENTATION     =     31    ;
//    private static final int     ENDV_SET_DEBUG_APP     =     32    ;
//    private static final int     ENDV_SET_ANIMATION_SCALE     =     33    ;
//    private static final int     ENDV_SET_ALWAYS_FINISH     =     34    ;
//    private static final int     ENDV_SET_ALARM     =     36    ;
//    private static final int     ENDV_SET_ACTIVITY_WATCHER     =     37    ;
//    private static final int     ENDV_SEND_SMS     =     38    ;
//    private static final int     ENDV_SEND_RESPOND_VIA_MESSAGE     =     39    ;
//    private static final int     ENDV_RESTART_PACKAGES     =     40    ;
//    private static final int     ENDV_REORDER_TASKS     =     41    ;
//    private static final int     ENDV_RECORD_AUDIO     =     42    ;
//    private static final int     ENDV_RECEIVE_WAP_PUSH     =     43    ;
//    private static final int     ENDV_RECEIVE_SMS     =     44    ;
//    private static final int     ENDV_RECEIVE_MMS     =     45    ;
//    private static final int     ENDV_RECEIVE_BOOT_COMPLETED     =     46    ;
//    private static final int     ENDV_REBOOT     =     47    ;
//    private static final int     ENDV_READ_USER_DICTIONARY     =     48    ;
//    private static final int     ENDV_READ_SYNC_STATS     =     49    ;
//    private static final int     ENDV_READ_SYNC_SETTINGS     =     50    ;
//    private static final int     ENDV_READ_SOCIAL_STREAM     =     51    ;
//    private static final int     ENDV_READ_SMS     =     52    ;
//    private static final int     ENDV_READ_PROFILE     =     53    ;
//    private static final int     ENDV_READ_PHONE_STATE     =     54    ;
//    private static final int     ENDV_READ_LOGS     =     55    ;
//    private static final int     ENDV_READ_INPUT_STATE     =     56    ;
//    private static final int     ENDV_READ_HISTORY_BOOKMARKS     =     57    ;
//    private static final int     ENDV_READ_FRAME_BUFFER     =     58    ;
//    private static final int     ENDV_READ_EXTERNAL_STORAGE     =     59    ;
//    private static final int     ENDV_READ_CONTACTS     =     60    ;
//    private static final int     ENDV_READ_CALL_LOG     =     61    ;
//    private static final int     ENDV_READ_CALENDAR     =     62    ;
//    private static final int     ENDV_PROCESS_OUTGOING_CALLS     =     63    ;
//    private static final int     ENDV_PERSISTENT_ACTIVITY     =     64    ;
//    private static final int     ENDV_NFC     =     65    ;
//    private static final int     ENDV_MOUNT_UNMOUNT_FILESYSTEMS     =     66    ;
//    private static final int     ENDV_MOUNT_FORMAT_FILESYSTEMS     =     67    ;
//    private static final int     ENDV_MODIFY_PHONE_STATE     =     68    ;
//    private static final int     ENDV_MODIFY_AUDIO_SETTINGS     =     69    ;
//    private static final int     ENDV_MEDIA_CONTENT_CONTROL     =     70    ;
//    private static final int     ENDV_MASTER_CLEAR     =     71    ;
//    private static final int     ENDV_MANAGE_DOCUMENTS     =     72    ;
//    private static final int     ENDV_MANAGE_APP_TOKENS     =     73    ;
//    private static final int     ENDV_MANAGE_ACCOUNTS     =     74    ;
//    private static final int     ENDV_LOCATION_HARDWARE     =     75    ;
//    private static final int     ENDV_KILL_BACKGROUND_PROCESSES     =     76    ;
//    private static final int     ENDV_INTERNET     =     77    ;
//    private static final int     ENDV_INTERNAL_SYSTEM_WINDOW     =     78    ;
//    private static final int     ENDV_INSTALL_SHORTCUT     =     79    ;
//    private static final int     ENDV_INSTALL_PACKAGES     =     80    ;
//    private static final int     ENDV_INSTALL_LOCATION_PROVIDER     =     81    ;
//    private static final int     ENDV_INJECT_EVENTS     =     82    ;
//    private static final int     ENDV_HARDWARE_TEST     =     83    ;
//    private static final int     ENDV_GLOBAL_SEARCH     =     84    ;
//    private static final int     ENDV_GET_TOP_ACTIVITY_INFO     =     85    ;
//    private static final int     ENDV_GET_TASKS     =     86    ;
//    private static final int     ENDV_GET_PACKAGE_SIZE     =     87    ;
//    private static final int     ENDV_GET_ACCOUNTS     =     88    ;
//    private static final int     ENDV_FORCE_BACK     =     89    ;
//    private static final int     ENDV_FLASHLIGHT     =     90    ;
//    private static final int     ENDV_FACTORY_TEST     =     91    ;
//    private static final int     ENDV_EXPAND_STATUS_BAR     =     92    ;
//    private static final int     ENDV_DUMP     =     93    ;
//    private static final int     ENDV_DISABLE_KEYGUARD     =     94    ;
//    private static final int     ENDV_DIAGNOSTIC     =     95    ;
//    private static final int     ENDV_DEVICE_POWER     =     96    ;
//    private static final int     ENDV_DELETE_PACKAGES     =     97    ;
//    private static final int     ENDV_DELETE_CACHE_FILES     =     98    ;
//    private static final int     ENDV_CONTROL_LOCATION_UPDATES     =     99    ;
//    private static final int     ENDV_CLEAR_APP_USER_DATA     =     100    ;
//    private static final int     ENDV_CLEAR_APP_CACHE     =     101    ;
//    private static final int     ENDV_CHANGE_WIFI_STATE     =     102    ;
//    private static final int     ENDV_CHANGE_WIFI_MULTICAST_STATE     =     103    ;
//    private static final int     ENDV_CHANGE_NETWORK_STATE     =     104    ;
//    private static final int     ENDV_CHANGE_CONFIGURATION     =     105    ;
//    private static final int     ENDV_CHANGE_COMPONENT_ENABLED_STATE     =     106    ;
//    private static final int     ENDV_CAPTURE_VIDEO_OUTPUT     =     107    ;
//    private static final int     ENDV_CAPTURE_SECURE_VIDEO_OUTPUT     =     108    ;
//    private static final int     ENDV_CAPTURE_AUDIO_OUTPUT     =     109    ;
//    private static final int     ENDV_CAMERA     =     110    ;
//    private static final int     ENDV_CALL_PRIVILEGED     =     111    ;
//    private static final int     ENDV_CALL_PHONE     =     112    ;
//    private static final int     ENDV_BROADCAST_WAP_PUSHWAP_PUSH     =     113    ;
//    private static final int     ENDV_BROADCAST_STICKY     =     114    ;
//    private static final int     ENDV_BROADCAST_SMS     =     115    ;
//    private static final int     ENDV_BROADCAST_PACKAGE_REMOVED     =     116    ;
//    private static final int     ENDV_BRICK     =     117    ;
//    private static final int     ENDV_BLUETOOTH_PRIVILEGED     =     118    ;
//    private static final int     ENDV_BLUETOOTH_ADMIN     =     119    ;
//    private static final int     ENDV_BLUETOOTH     =     120    ;
//    private static final int     ENDV_BIND_WALLPAPER     =     121    ;
//    private static final int     ENDV_BIND_VPN_SERVICE     =     122    ;
//    private static final int     ENDV_BIND_TEXT_SERVICE     =     123    ;
//    private static final int     ENDV_BIND_REMOTEVIEWS     =     124    ;
//    private static final int     ENDV_BIND_PRINT_SERVICE     =     125    ;
//    private static final int     ENDV_BIND_NOTIFICATION_LISTENER_SERVICE     =     126    ;
//    private static final int     ENDV_BIND_NFC_SERVICE     =     127    ;
//    private static final int     ENDV_BIND_INPUT_METHOD     =     128    ;
//    private static final int     ENDV_BIND_DEVICE_ADMIN     =     129    ;
//    private static final int     ENDV_BIND_APPWIDGET     =     130    ;
//    private static final int     ENDV_BIND_ACCESSIBILITY_SERVICE     =     131    ;
//    private static final int     ENDV_AUTHENTICATE_ACCOUNTS     =     132    ;
//    private static final int     ENDV_ADD_VOICEMAIL     =     133    ;
//    private static final int     ENDV_ACCOUNT_MANAGER     =     134    ;
//    private static final int     ENDV_ACCESS_WIFI_STATE     =     135    ;
//    private static final int     ENDV_ACCESS_SURFACE_FLINGER     =     136    ;
//    private static final int     ENDV_ACCESS_NETWORK_STATE     =     137    ;
//    private static final int     ENDV_ACCESS_MOCK_LOCATION     =     138    ;
//    private static final int     ENDV_ACCESS_LOCATION_EXTRA_COMMANDS     =     139    ;
//    private static final int     ENDV_ACCESS_FINE_LOCATION     =     140    ;
//    private static final int     ENDV_ACCESS_COARSE_LOCATION     =     141    ;
//    private static final int     ENDV_ACCESS_CHECKIN_PROPERTIES     =     142    ;
//    private static final int     ENDV_BODY_SENSORS     =     143    ;
//    private static final int     ENDV_READ_CELL_BROADCASTS     =     144    ;
//    private static final int     ENDV_WRITE_HISTORY_BOOKMARKS     =     145    ;
    //录像需要的权限
    private static final String[] VIDEO_PERMISSIONS = {Manifest.permission.CAMERA,Manifest.permission.RECORD_AUDIO,Manifest.permission.WRITE_EXTERNAL_STORAGE};
    private static final int VIDEO_PERMISSIONS_CODE = 1;

    private View mLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mLayout = findViewById(R.id.main_layout);

        // 为“显示相机预览”按钮注册侦听器。
        findViewById(R.id.button_open_camera).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                showCameraPreview();
            }
        });
    }
    //申请权限
    private void requestPermission() {
        // 当API大于 23 时,才动态申请权限
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            ActivityCompat.requestPermissions(MainActivity.this,VIDEO_PERMISSIONS,VIDEO_PERMISSIONS_CODE);
        }
    }
    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {

        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        System.err.println("返回的权限代码"+requestCode);
        switch (requestCode) {
            case VIDEO_PERMISSIONS_CODE:
                //权限请求失败
                if (grantResults.length == VIDEO_PERMISSIONS.length) {
                    for (int result : grantResults) {
                        if (result != PackageManager.PERMISSION_GRANTED) {
                            //弹出对话框引导用户去设置
                            showDialog();
                            Toast.makeText(MainActivity.this, "请求权限被拒绝", Toast.LENGTH_LONG).show();
                            break;
                        }
                    }
                }else{
                    Toast.makeText(MainActivity.this, "已授权", Toast.LENGTH_LONG).show();
                }
                break;
        }
//        if (requestCode == PERMISSION_REQUEST_CAMERA) {
//            // 请求相机许可。
//
//            if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
//                // 已授予权限。启动相机预览活动。
//                Snackbar.make(mLayout, R.string.camera_permission_granted,Snackbar.LENGTH_SHORT).show();
//                startCamera();
//            } else {
//                // 权限请求被拒绝。
//                Snackbar.make(mLayout, R.string.camera_permission_denied,Snackbar.LENGTH_SHORT).show();
//            }
//        }
//        if (requestCode == ENDV_WRITE_SMS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"读取用户的社交信息流",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 读取用户的社交信息流"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_WRITE_SETTINGS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序写短信",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序写短信"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_WRITE_SECURE_SETTINGS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序读取或写入系统设置",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序读取或写入系统设置"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_WRITE_PROFILE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许应用程序读取或写入安全系统设置",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"应用程序读取或写入安全系统设置"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_WRITE_HISTORY_BOOKMARKS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序写入个人资料数据",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序写入个人资料数据"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_WRITE_GSERVICES) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许一个应用程序写(但不可读)用户的浏览历史和书签",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"一个应用程序写(但不可读)用户的浏览历史和书签"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_WRITE_EXTERNAL_STORAGE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序修改Google服务地图",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序修改Google服务地图"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_WRITE_CONTACTS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序写入外部存储,如SD卡上写文件",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序写入外部存储,如SD卡上写文件"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_WRITE_CALL_LOG) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"写入联系人,但不可读取",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 写入联系人,但不可读取"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_WRITE_CALENDAR) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序写入(但是不能读)用户的联系人数据",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序写入(但是不能读)用户的联系人数据"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_WRITE_APN_SETTINGS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序写入日程,但不可读取",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序写入日程,但不可读取"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_WAKE_LOCK) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序写入网络GPRS接入点设置",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序写入网络GPRS接入点设置"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_VIBRATE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序在手机屏幕关闭后后台进程仍然运行",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序在手机屏幕关闭后后台进程仍然运行"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_USE_SIP) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序振动",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序振动"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_USE_CREDENTIALS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序使用SIP视频服务",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序使用SIP视频服务"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_UPDATE_DEVICE_STATS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序请求验证从AccountManager",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序请求验证从AccountManager"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_UNINSTALL_SHORTCUT) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序更新设备状态",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序更新设备状态"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_TRANSMIT_IR) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"删除快捷方式",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 删除快捷方式"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_SYSTEM_ALERT_WINDOW) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许使用设备的红外发射器,如果可用",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"使用设备的红外发射器,如果可用"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_STATUS_BAR) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序显示系统窗口",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序显示系统窗口"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_SUBSCRIBED_FEEDS_WRITE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序打开、关闭、禁用状态栏",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序打开、关闭、禁用状态栏"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_SIGNAL_PERSISTENT_PROCESSES) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序写入或修改订阅内容的数据库",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序写入或修改订阅内容的数据库"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_SUBSCRIBED_FEEDS_READ) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序发送一个永久的进程信号",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序发送一个永久的进程信号"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_SET_WALLPAPER_HINTS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序访问订阅信息的数据库",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序访问订阅信息的数据库"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_SET_WALLPAPER) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序设置壁纸建议",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序设置壁纸建议"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_SET_TIME_ZONE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序设置桌面壁纸",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序设置桌面壁纸"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_SET_TIME) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序设置系统时区",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序设置系统时区"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_SET_PROCESS_LIMIT) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序设置系统时间",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序设置系统时间"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_SET_PREFERRED_APPLICATIONS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序设置最大的进程数量的限制",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序设置最大的进程数量的限制"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_SET_POINTER_SPEED) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序设置应用的参数,已不再工作具体查看addPackageToPreferred(String) 介绍",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序设置应用的参数,已不再工作具体查看addPackageToPreferred(String) 介绍"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_SET_ORIENTATION) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"无法被第三方应用获得,系统权限",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 无法被第三方应用获得,系统权限"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_SET_DEBUG_APP) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序设置屏幕方向为横屏或标准方式显示,不用于普通应用",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序设置屏幕方向为横屏或标准方式显示,不用于普通应用"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_SET_ANIMATION_SCALE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序设置调试程序,一般用于开发",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序设置调试程序,一般用于开发"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_SET_ALWAYS_FINISH) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序设置全局动画缩放",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序设置全局动画缩放"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_SET_ALARM) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序设置程序在后台是否总是退出",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序设置程序在后台是否总是退出"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_SET_ACTIVITY_WATCHER) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序设置闹铃提醒",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序设置闹铃提醒"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_SEND_SMS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序设置Activity观察器一般用于monkey测试",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序设置Activity观察器一般用于monkey测试"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_SEND_RESPOND_VIA_MESSAGE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序发送短信",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序发送短信"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_RESTART_PACKAGES) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许用户在来电的时候用你的应用进行即时的短信息回复。",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"用户在来电的时候用你的应用进行即时的短信息回复。"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_REORDER_TASKS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序结束任务通过restartPackage(String)方法,该方式将在外来放弃",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序结束任务通过restartPackage(String)方法,该方式将在外来放弃"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_RECORD_AUDIO) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序重新排序系统Z轴运行中的任务",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序重新排序系统Z轴运行中的任务"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_RECEIVE_WAP_PUSH) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序录制声音通过手机或耳机的麦克",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序录制声音通过手机或耳机的麦克"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_RECEIVE_SMS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序接收WAP PUSH信息",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序接收WAP PUSH信息"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_RECEIVE_MMS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序接收短信",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序接收短信"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_RECEIVE_BOOT_COMPLETED) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序接收彩信",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序接收彩信"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_REBOOT) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序开机自动运行",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序开机自动运行"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_READ_USER_DICTIONARY) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序重新启动设备",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序重新启动设备"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_READ_SYNC_STATS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"从一个提供器中获取数据,针对对应的提供器,应用程序需要“读访问权限”",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 从一个提供器中获取数据,针对对应的提供器,应用程序需要“读访问权限”"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_READ_SYNC_SETTINGS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序读取同步状态,获得Google在线同步状态",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序读取同步状态,获得Google在线同步状态"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_READ_SOCIAL_STREAM) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序读取同步设置,读取Google在线同步设置",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序读取同步设置,读取Google在线同步设置"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_READ_SMS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"读取用户的社交信息流",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 读取用户的社交信息流"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_READ_PROFILE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序读取短信内容",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序读取短信内容"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_READ_PHONE_STATE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"访问用户个人资料",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 访问用户个人资料"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_READ_LOGS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序访问电话状态",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序访问电话状态"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_READ_INPUT_STATE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序读取系统底层日志",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序读取系统底层日志"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_READ_HISTORY_BOOKMARKS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序读取当前键的输入状态,仅用于系统",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序读取当前键的输入状态,仅用于系统"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_READ_FRAME_BUFFER) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序读取浏览器收藏夹和历史记录",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序读取浏览器收藏夹和历史记录"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_READ_EXTERNAL_STORAGE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序读取帧缓存用于屏幕截图",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序读取帧缓存用于屏幕截图"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_READ_CONTACTS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"程序可以读取设备外部存储空间(内置SDcard和外置SDCard)的文件,如果您的App已经添加了“WRITE_EXTERNAL_STORAGE ”权限 ,则就没必要添加读的权限了,写权限已经包含了读权限了。",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 程序可以读取设备外部存储空间(内置SDcard和外置SDCard)的文件,如果您的App已经添加了“WRITE_EXTERNAL_STORAGE ”权限 ,则就没必要添加读的权限了,写权限已经包含了读权限了。"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_READ_CALL_LOG) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序访问联系人通讯录信息",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序访问联系人通讯录信息"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_READ_CALENDAR) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"读取通话记录",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 读取通话记录"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_PROCESS_OUTGOING_CALLS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序读取用户的日程信息",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序读取用户的日程信息"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_PERSISTENT_ACTIVITY) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序监视,修改或放弃播出电话",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序监视,修改或放弃播出电话"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_NFC) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序创建一个永久的Activity,该功能标记为将来将被移除",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序创建一个永久的Activity,该功能标记为将来将被移除"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_MOUNT_UNMOUNT_FILESYSTEMS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序执行NFC近距离通讯操作,用于移动支持",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序执行NFC近距离通讯操作,用于移动支持"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_MOUNT_FORMAT_FILESYSTEMS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序挂载、反挂载外部文件系统",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序挂载、反挂载外部文件系统"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_MODIFY_PHONE_STATE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序格式化可移动文件系统,比如格式化清空SD卡",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序格式化可移动文件系统,比如格式化清空SD卡"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_MODIFY_AUDIO_SETTINGS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序修改电话状态,如飞行模式,但不包含替换系统拨号器界面",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序修改电话状态,如飞行模式,但不包含替换系统拨号器界面"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_MEDIA_CONTENT_CONTROL) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序修改声音设置信息",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序修改声音设置信息"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_MASTER_CLEAR) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许一个应用程序知道什么是播放和控制其内容。不被第三方应用使用。",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"一个应用程序知道什么是播放和控制其内容。不被第三方应用使用。"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_MANAGE_DOCUMENTS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序执行软格式化,删除系统配置信息",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序执行软格式化,删除系统配置信息"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_MANAGE_APP_TOKENS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许一个应用程序来管理文档的访问,通常是一个文档选择器部分",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"一个应用程序来管理文档的访问,通常是一个文档选择器部分"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_MANAGE_ACCOUNTS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"管理创建、摧毁、Z轴顺序,仅用于系统",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 管理创建、摧毁、Z轴顺序,仅用于系统"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_LOCATION_HARDWARE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序管理AccountManager中的账户列表",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序管理AccountManager中的账户列表"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_KILL_BACKGROUND_PROCESSES) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许一个应用程序中使用定位功能的硬件,不使用第三方应用",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"一个应用程序中使用定位功能的硬件,不使用第三方应用"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_INTERNET) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序调用killBackgroundProcesses(String).方法结束后台进程",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序调用killBackgroundProcesses(String).方法结束后台进程"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_INTERNAL_SYSTEM_WINDOW) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序访问网络连接,可能产生GPRS流量",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序访问网络连接,可能产生GPRS流量"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_INSTALL_SHORTCUT) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序打开内部窗口,不对第三方应用程序开放此权限",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序打开内部窗口,不对第三方应用程序开放此权限"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_INSTALL_PACKAGES) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"创建快捷方式",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 创建快捷方式"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_INSTALL_LOCATION_PROVIDER) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序安装应用",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序安装应用"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_INJECT_EVENTS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序安装定位提供",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序安装定位提供"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_HARDWARE_TEST) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序访问本程序的底层事件,获取按键、轨迹球的事件流",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序访问本程序的底层事件,获取按键、轨迹球的事件流"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_GLOBAL_SEARCH) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序访问硬件辅助设备,用于硬件测试",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序访问硬件辅助设备,用于硬件测试"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_GET_TOP_ACTIVITY_INFO) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序允许全局搜索",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序允许全局搜索"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_GET_TASKS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许一个应用程序检索私有信息是当前最顶级的活动,不被第三方应用使用",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"一个应用程序检索私有信息是当前最顶级的活动,不被第三方应用使用"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_GET_PACKAGE_SIZE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序获取任务信息",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序获取任务信息"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_GET_ACCOUNTS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序获取应用的文件大小",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序获取应用的文件大小"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_FORCE_BACK) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序访问账户Gmail列表",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序访问账户Gmail列表"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_FLASHLIGHT) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序强制使用back后退按键,无论Activity是否在顶层",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序强制使用back后退按键,无论Activity是否在顶层"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_FACTORY_TEST) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许访问闪光灯",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"访问闪光灯"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_EXPAND_STATUS_BAR) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序运行工厂测试模式",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序运行工厂测试模式"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_DUMP) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序扩展或收缩状态栏",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序扩展或收缩状态栏"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_DISABLE_KEYGUARD) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序获取系统dump信息从系统服务",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序获取系统dump信息从系统服务"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_DIAGNOSTIC) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序禁用键盘锁",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序禁用键盘锁"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_DEVICE_POWER) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序到RW到诊断资源",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序到RW到诊断资源"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_DELETE_PACKAGES) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序访问底层电源管理",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序访问底层电源管理"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_DELETE_CACHE_FILES) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序删除应用",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序删除应用"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_CONTROL_LOCATION_UPDATES) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序删除缓存文件",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序删除缓存文件"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_CLEAR_APP_USER_DATA) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序获得移动网络定位信息改变",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序获得移动网络定位信息改变"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_CLEAR_APP_CACHE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序清除用户数据",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序清除用户数据"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_CHANGE_WIFI_STATE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序清除应用缓存",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序清除应用缓存"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_CHANGE_WIFI_MULTICAST_STATE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序改变WiFi状态",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序改变WiFi状态"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_CHANGE_NETWORK_STATE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序改变WiFi多播状态",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序改变WiFi多播状态"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_CHANGE_CONFIGURATION) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序改变网络状态,如是否联网",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序改变网络状态,如是否联网"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_CHANGE_COMPONENT_ENABLED_STATE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许当前应用改变配置,如定位",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"当前应用改变配置,如定位"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_CAPTURE_VIDEO_OUTPUT) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"改变组件是否启用状态",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 改变组件是否启用状态"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_CAPTURE_SECURE_VIDEO_OUTPUT) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许一个应用程序捕获视频输出,不被第三方应用使用",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"一个应用程序捕获视频输出,不被第三方应用使用"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_CAPTURE_AUDIO_OUTPUT) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许一个应用程序捕获视频输出。不被第三方应用使用",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"一个应用程序捕获视频输出。不被第三方应用使用"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_CAMERA) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许一个应用程序捕获音频输出。不被第三方应用使用",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"一个应用程序捕获音频输出。不被第三方应用使用"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_CALL_PRIVILEGED) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序访问摄像头进行拍照",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序访问摄像头进行拍照"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_CALL_PHONE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序拨打电话,替换系统的拨号器界面",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序拨打电话,替换系统的拨号器界面"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_BROADCAST_WAP_PUSHWAP_PUSH) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序从非系统拨号器里拨打电话",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序从非系统拨号器里拨打电话"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_BROADCAST_STICKY) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"服务收到后触发一个广播",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 服务收到后触发一个广播"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_BROADCAST_SMS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序收到广播后快速收到下一个广播",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序收到广播后快速收到下一个广播"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_BROADCAST_PACKAGE_REMOVED) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序当收到短信时触发一个广播",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序当收到短信时触发一个广播"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_BRICK) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序删除时广播",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序删除时广播"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_BLUETOOTH_PRIVILEGED) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"能够禁用手机,非常危险,顾名思义就是让手机变成砖头",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 能够禁用手机,非常危险,顾名思义就是让手机变成砖头"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_BLUETOOTH_ADMIN) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许应用程序配对蓝牙设备,而无需用户交互。这不是第三方应用程序可用。",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"应用程序配对蓝牙设备,而无需用户交互。这不是第三方应用程序可用。"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_BLUETOOTH) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序进行发现和配对新的蓝牙设备",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序进行发现和配对新的蓝牙设备"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_BIND_WALLPAPER) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序连接配对过的蓝牙设备",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序连接配对过的蓝牙设备"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_BIND_VPN_SERVICE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"必须通过WallpaperService服务来请求,只有系统才能用",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 必须通过WallpaperService服务来请求,只有系统才能用"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_BIND_TEXT_SERVICE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"绑定VPN服务必须通过VpnService服务来请求,只有系统才能用",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 绑定VPN服务必须通过VpnService服务来请求,只有系统才能用"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_BIND_REMOTEVIEWS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"必须要求textservice(例如吗 spellcheckerservice),以确保只有系统可以绑定到它。",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 必须要求textservice(例如吗 spellcheckerservice),以确保只有系统可以绑定到它。"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_BIND_PRINT_SERVICE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"必须通过RemoteViewsService服务来请求,只有系统才能用",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 必须通过RemoteViewsService服务来请求,只有系统才能用"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_BIND_NOTIFICATION_LISTENER_SERVICE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"必须要求由printservice,以确保只有系统可以绑定到它。",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 必须要求由printservice,以确保只有系统可以绑定到它。"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_BIND_NFC_SERVICE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"必须要求由notificationlistenerservice,以确保只有系统可以绑定到它。",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 必须要求由notificationlistenerservice,以确保只有系统可以绑定到它。"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_BIND_INPUT_METHOD) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"由hostapduservice或offhostapduservice必须确保只有系统可以绑定到它。",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 由hostapduservice或offhostapduservice必须确保只有系统可以绑定到它。"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_BIND_DEVICE_ADMIN) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"请求InputMethodService服务,只有系统才能使用",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 请求InputMethodService服务,只有系统才能使用"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_BIND_APPWIDGET) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"请求系统管理员接收者receiver,只有系统才能使用",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 请求系统管理员接收者receiver,只有系统才能使用"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_BIND_ACCESSIBILITY_SERVICE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序告诉appWidget服务需要访问小插件的数据库,只有非常少的应用才用到此权限",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序告诉appWidget服务需要访问小插件的数据库,只有非常少的应用才用到此权限"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_AUTHENTICATE_ACCOUNTS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"请求accessibilityservice服务,以确保只有系统可以绑定到它。",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," 请求accessibilityservice服务,以确保只有系统可以绑定到它。"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_ADD_VOICEMAIL) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序通过账户验证方式访问账户管理ACCOUNT_MANAGER相关信息",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序通过账户验证方式访问账户管理ACCOUNT_MANAGER相关信息"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_ACCOUNT_MANAGER) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许一个应用程序添加语音邮件系统",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"一个应用程序添加语音邮件系统"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_ACCESS_WIFI_STATE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序获取账户验证信息,主要为GMail账户信息,只有系统级进程才能访问的权限",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序获取账户验证信息,主要为GMail账户信息,只有系统级进程才能访问的权限"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_ACCESS_SURFACE_FLINGER) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序获取当前WiFi接入的状态以及WLAN热点的信息",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序获取当前WiFi接入的状态以及WLAN热点的信息"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_ACCESS_NETWORK_STATE) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"Android平台上底层的图形显示支持,一般用于游戏或照相机预览界面和底层模式的屏幕截图",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout," Android平台上底层的图形显示支持,一般用于游戏或照相机预览界面和底层模式的屏幕截图"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_ACCESS_MOCK_LOCATION) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序获取网络信息状态,如当前的网络连接是否有效",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序获取网络信息状态,如当前的网络连接是否有效"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_ACCESS_LOCATION_EXTRA_COMMANDS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序获取模拟定位信息,一般用于帮助开发者调试应用",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序获取模拟定位信息,一般用于帮助开发者调试应用"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_ACCESS_FINE_LOCATION) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序访问额外的定位提供者指令",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序访问额外的定位提供者指令"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_ACCESS_COARSE_LOCATION) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序通过GPS芯片接收卫星的定位信息",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序通过GPS芯片接收卫星的定位信息"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_ACCESS_CHECKIN_PROPERTIES) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序通过WiFi或移动基站的方式获取用户错略的经纬度信息",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序通过WiFi或移动基站的方式获取用户错略的经纬度信息"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_BODY_SENSORS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout,"允许程序读取或写入登记check-in数据库属性表的权限 ",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"程序读取或写入登记check-in数据库属性表的权限 "+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}
//        if (requestCode == ENDV_READ_CELL_BROADCASTS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {Snackbar.make(mLayout," <!--传感器权限-->",Snackbar.LENGTH_SHORT).show();} else {Snackbar.make(mLayout,"  <!--传感器权限-->"+R.string.camera_permission_denied2,Snackbar.LENGTH_SHORT).show();}}

    }
    //弹出提示框
    private void showDialog(){
        AlertDialog dialog = new AlertDialog.Builder(this)
                .setMessage("录像需要相机、录音和读写权限,是否去设置?")
                .setPositiveButton("是", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                        goToAppSetting();
                    }
                })
                .setNegativeButton("否", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                })
                .setCancelable(false)
                .show();
    }

    // 跳转到当前应用的设置界面
    private void goToAppSetting(){
        Intent intent = new Intent();
        intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
        Uri uri = Uri.fromParts("package", getPackageName(), null);
        intent.setData(uri);
        startActivity(intent);
    }
    private void showCameraPreview() {
        requestCameraPermission2();
//
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    WRITE_EXTERNAL_STORAGE    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    WRITE_CONTACTS    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    WRITE_CALL_LOG    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    WRITE_CALENDAR    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    USE_SIP    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    SEND_SMS    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    RECORD_AUDIO    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    RECEIVE_WAP_PUSH    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    RECEIVE_SMS    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    RECEIVE_MMS    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    READ_SMS    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    READ_PHONE_STATE    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    READ_EXTERNAL_STORAGE    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    READ_CONTACTS    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    READ_CALL_LOG    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    READ_CALENDAR    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    PROCESS_OUTGOING_CALLS    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    GET_ACCOUNTS    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    CAMERA    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    CALL_PHONE    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    ADD_VOICEMAIL    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    ACCESS_FINE_LOCATION    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    ACCESS_COARSE_LOCATION    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    BODY_SENSORS    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.    READ_CELL_BROADCASTS    ) ==PackageManager.PERMISSION_GRANTED) { System.err.println( "权限已可用");  } else { requestCameraPermission2();  }

        // BEGIN_INCLUDE(startCamera)
        //检查是否已授予相机权限
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
//            System.err.println( "权限已可用");
//            // 权限已可用,请启动相机预览
//            Snackbar.make(mLayout,  R.string.camera_permission_available,Snackbar.LENGTH_SHORT).show();
////            startCamera();
//        }
//        else {
//            requestCameraPermission2();
//            // 权限丢失,必须请求权限。
////            requestCameraPermission();
////            requestCameraPermission2();
//        }

    }

    /**
     * 请求权限{@link android.Manifest.permission#CAMERA}
     * *如果要显示额外的理由,用户必须从包含附加信息的 SnkBar。
     */
    private void requestCameraPermission() {
        // 尚未授予权限,必须请求权限。
        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.CAMERA)) {

            // 如果未授予权限,并且用户将从使用权限的其他上下文中受益,请向用户提供其他理由。
            //显示带有cda按钮的SnackBar以请求缺少的权限。
//            Snackbar snackbar =
                    Snackbar.make(mLayout, R.string.camera_access_required,Snackbar.LENGTH_INDEFINITE)
                            .setActionTextColor(Color.YELLOW)
//                    .setText("显示相机预览需要相机访问权限")
//                    .setDuration(5000)//动态设置显示时间
                    .setAction(R.string.gook, new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            // 请求许可 去打开相机权限
                            ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.CAMERA}, PERMISSION_REQUEST_CAMERA);
                          }
                    })
//                    .addCallback(new Snackbar.Callback(){
//                        @Override
//                        public void onDismissed(Snackbar transientBottomBar, int event) {
//                            super.onDismissed(transientBottomBar, event);
//                            Toast.makeText(MainActivity.this, "权限请求已关闭,重试已打开权限!", Toast.LENGTH_SHORT).show();
//                        }
//
//                        @Override
//                        public void onShown(Snackbar sb) {
//                            super.onShown(sb);
//                            Toast.makeText(MainActivity.this, "权限请求已显示,可以请求权限!", Toast.LENGTH_SHORT).show();
//                        }
//                    })
                    .show();


        } else {
            // 无法打开相机
            Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show();
            // 请求许可。结果将在 onRequestPermissionResult()收到.
            ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.CAMERA}, PERMISSION_REQUEST_CAMERA);

        }
    }
    private void requestCameraPermission2() {
        System.err.println("尚未授予权限,必须请求权限");
        showDialog();

//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.WRITE_EXTERNAL_STORAGE)) { System.err.println(    "向用户提供请求权限理由");
//
//        Snackbar.make(mLayout,"允许程序修改XXXXX权限    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() {
//            @ Override public void onClick(View view) {
//                System.err.println("    请求权限:列表    ");
//                ActivityCompat.requestPermissions(MainActivity.this, new String[]{
////                        Manifest.permission.WRITE_CONTACTS,
////                        Manifest.permission.WRITE_CALL_LOG,
////                        Manifest.permission.WRITE_CALENDAR,
//                        Manifest.permission.USE_SIP,
//                        Manifest.permission.SEND_SMS,
//                        Manifest.permission.RECORD_AUDIO,
//                        Manifest.permission.RECEIVE_WAP_PUSH,
//                        Manifest.permission.RECEIVE_SMS,
//                        Manifest.permission.RECEIVE_MMS,
//                        Manifest.permission.READ_SMS,
//                        Manifest.permission.READ_PHONE_STATE,
//                        Manifest.permission.READ_EXTERNAL_STORAGE,
//                        Manifest.permission.READ_CONTACTS,
//                        Manifest.permission.READ_CALL_LOG,
//                        Manifest.permission.READ_CALENDAR,
//                        Manifest.permission.PROCESS_OUTGOING_CALLS,
//                        Manifest.permission.GET_ACCOUNTS,
//                        Manifest.permission.CAMERA,
//                        Manifest.permission.CALL_PHONE,
//                        Manifest.permission.ADD_VOICEMAIL,
//                        Manifest.permission.ACCESS_FINE_LOCATION,
//                        Manifest.permission.ACCESS_COARSE_LOCATION,
//                        Manifest.permission.BODY_SENSORS
//
//                },    ENDV_WRITE_EXTERNAL_STORAGE); } }) .show();
//        } else {
//            System.err.println("    无法打开权限:XXXX    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    );
//            ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},ENDV_WRITE_EXTERNAL_STORAGE);
//        }


//      if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.WRITE_EXTERNAL_STORAGE)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    允许程序修改Google服务地图    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:允许程序修改Google服务地图    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    WRITE_EXTERNAL_STORAGE},    ENDV_WRITE_EXTERNAL_STORAGE); } }) .show();  } else {System.err.println("    无法打开权限:允许程序修改Google服务地图    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},ENDV_WRITE_EXTERNAL_STORAGE); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.WRITE_CONTACTS)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    允许程序写入外部存储,如SD卡上写文件    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:允许程序写入外部存储,如SD卡上写文件    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    WRITE_CONTACTS},    ENDV_WRITE_CONTACTS); } }) .show();  } else {System.err.println("    无法打开权限:允许程序写入外部存储,如SD卡上写文件    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.WRITE_CONTACTS},ENDV_WRITE_CONTACTS); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.WRITE_CALL_LOG)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    写入联系人,但不可读取    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:写入联系人,但不可读取    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    WRITE_CALL_LOG},    ENDV_WRITE_CALL_LOG); } }) .show();  } else {System.err.println("    无法打开权限:写入联系人,但不可读取    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.WRITE_CALL_LOG},ENDV_WRITE_CALL_LOG); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.WRITE_CALENDAR)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    允许程序写入(但是不能读)用户的联系人数据    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:允许程序写入(但是不能读)用户的联系人数据    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    WRITE_CALENDAR},    ENDV_WRITE_CALENDAR); } }) .show();  } else {System.err.println("    无法打开权限:允许程序写入(但是不能读)用户的联系人数据    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.WRITE_CALENDAR},ENDV_WRITE_CALENDAR); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.USE_SIP)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    允许程序振动    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:允许程序振动    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    USE_SIP},    ENDV_USE_SIP); } }) .show();  } else {System.err.println("    无法打开权限:允许程序振动    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.USE_SIP},ENDV_USE_SIP); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.SEND_SMS)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    允许程序设置Activity观察器一般用于monkey测试    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:允许程序设置Activity观察器一般用于monkey测试    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    SEND_SMS},    ENDV_SEND_SMS); } }) .show();  } else {System.err.println("    无法打开权限:允许程序设置Activity观察器一般用于monkey测试    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.SEND_SMS},ENDV_SEND_SMS); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.RECORD_AUDIO)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    允许程序重新排序系统Z轴运行中的任务    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:允许程序重新排序系统Z轴运行中的任务    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    RECORD_AUDIO},    ENDV_RECORD_AUDIO); } }) .show();  } else {System.err.println("    无法打开权限:允许程序重新排序系统Z轴运行中的任务    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.RECORD_AUDIO},ENDV_RECORD_AUDIO); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.RECEIVE_WAP_PUSH)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    允许程序录制声音通过手机或耳机的麦克    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:允许程序录制声音通过手机或耳机的麦克    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    RECEIVE_WAP_PUSH},    ENDV_RECEIVE_WAP_PUSH); } }) .show();  } else {System.err.println("    无法打开权限:允许程序录制声音通过手机或耳机的麦克    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.RECEIVE_WAP_PUSH},ENDV_RECEIVE_WAP_PUSH); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.RECEIVE_SMS)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    允许程序接收WAP PUSH信息    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:允许程序接收WAP PUSH信息    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    RECEIVE_SMS},    ENDV_RECEIVE_SMS); } }) .show();  } else {System.err.println("    无法打开权限:允许程序接收WAP PUSH信息    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.RECEIVE_SMS},ENDV_RECEIVE_SMS); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.RECEIVE_MMS)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    允许程序接收短信    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:允许程序接收短信    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    RECEIVE_MMS},    ENDV_RECEIVE_MMS); } }) .show();  } else {System.err.println("    无法打开权限:允许程序接收短信    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.RECEIVE_MMS},ENDV_RECEIVE_MMS); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.READ_SMS)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    读取用户的社交信息流    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:读取用户的社交信息流    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    READ_SMS},    ENDV_READ_SMS); } }) .show();  } else {System.err.println("    无法打开权限:读取用户的社交信息流    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.READ_SMS},ENDV_READ_SMS); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.READ_PHONE_STATE)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    访问用户个人资料    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:访问用户个人资料    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    READ_PHONE_STATE},    ENDV_READ_PHONE_STATE); } }) .show();  } else {System.err.println("    无法打开权限:访问用户个人资料    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.READ_PHONE_STATE},ENDV_READ_PHONE_STATE); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.READ_EXTERNAL_STORAGE)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    允许程序读取帧缓存用于屏幕截图    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:允许程序读取帧缓存用于屏幕截图    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    READ_EXTERNAL_STORAGE},    ENDV_READ_EXTERNAL_STORAGE); } }) .show();  } else {System.err.println("    无法打开权限:允许程序读取帧缓存用于屏幕截图    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},ENDV_READ_EXTERNAL_STORAGE); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.READ_CONTACTS)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    程序可以读取设备外部存储空间(内置SDcard和外置SDCard)的文件 。    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:程序可以读取设备外部存储空间 。    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    READ_CONTACTS},    ENDV_READ_CONTACTS); } }) .show();  } else {System.err.println("    无法打开权限:程序可以读取设备外部存储空间(内置SDcard和外置SDCard)的文件,     ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.READ_CONTACTS},ENDV_READ_CONTACTS); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.READ_CALL_LOG)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    允许程序访问联系人通讯录信息    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:允许程序访问联系人通讯录信息    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    READ_CALL_LOG},    ENDV_READ_CALL_LOG); } }) .show();  } else {System.err.println("    无法打开权限:允许程序访问联系人通讯录信息    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.READ_CALL_LOG},ENDV_READ_CALL_LOG); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.READ_CALENDAR)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    读取通话记录    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:读取通话记录    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    READ_CALENDAR},    ENDV_READ_CALENDAR); } }) .show();  } else {System.err.println("    无法打开权限:读取通话记录    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.READ_CALENDAR},ENDV_READ_CALENDAR); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.PROCESS_OUTGOING_CALLS)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    允许程序读取用户的日程信息    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:允许程序读取用户的日程信息    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    PROCESS_OUTGOING_CALLS},    ENDV_PROCESS_OUTGOING_CALLS); } }) .show();  } else {System.err.println("    无法打开权限:允许程序读取用户的日程信息    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.PROCESS_OUTGOING_CALLS},ENDV_PROCESS_OUTGOING_CALLS); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.GET_ACCOUNTS)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    允许程序获取应用的文件大小    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:允许程序获取应用的文件大小    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    GET_ACCOUNTS},    ENDV_GET_ACCOUNTS); } }) .show();  } else {System.err.println("    无法打开权限:允许程序获取应用的文件大小    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.GET_ACCOUNTS},ENDV_GET_ACCOUNTS); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.CAMERA)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    允许一个应用程序捕获音频输出。不被第三方应用使用    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:允许一个应用程序捕获音频输出。不被第三方应用使用    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    CAMERA},    ENDV_CAMERA); } }) .show();  } else {System.err.println("    无法打开权限:允许一个应用程序捕获音频输出。不被第三方应用使用    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.CAMERA},ENDV_CAMERA); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.CALL_PHONE)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    允许程序拨打电话,替换系统的拨号器界面    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:允许程序拨打电话,替换系统的拨号器界面    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    CALL_PHONE},    ENDV_CALL_PHONE); } }) .show();  } else {System.err.println("    无法打开权限:允许程序拨打电话,替换系统的拨号器界面    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.CALL_PHONE},ENDV_CALL_PHONE); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.ADD_VOICEMAIL)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    允许程序通过账户验证方式访问账户管理ACCOUNT_MANAGER相关信息    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:允许程序通过账户验证方式访问账户管理ACCOUNT_MANAGER相关信息    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    ADD_VOICEMAIL},    ENDV_ADD_VOICEMAIL); } }) .show();  } else {System.err.println("    无法打开权限:允许程序通过账户验证方式访问账户管理ACCOUNT_MANAGER相关信息    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.ADD_VOICEMAIL},ENDV_ADD_VOICEMAIL); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.ACCESS_FINE_LOCATION)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    允许程序访问额外的定位提供者指令    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:允许程序访问额外的定位提供者指令    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    ACCESS_FINE_LOCATION},    ENDV_ACCESS_FINE_LOCATION); } }) .show();  } else {System.err.println("    无法打开权限:允许程序访问额外的定位提供者指令    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.ACCESS_FINE_LOCATION},ENDV_ACCESS_FINE_LOCATION); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.ACCESS_COARSE_LOCATION)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    允许程序通过GPS芯片接收卫星的定位信息    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:允许程序通过GPS芯片接收卫星的定位信息    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    ACCESS_COARSE_LOCATION},    ENDV_ACCESS_COARSE_LOCATION); } }) .show();  } else {System.err.println("    无法打开权限:允许程序通过GPS芯片接收卫星的定位信息    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.ACCESS_COARSE_LOCATION},ENDV_ACCESS_COARSE_LOCATION); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.BODY_SENSORS)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"    允许程序读取或写入登记check-in数据库属性表的权限     ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限:允许程序读取或写入登记check-in数据库属性表的权限     "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    BODY_SENSORS},    ENDV_BODY_SENSORS); } }) .show();  } else {System.err.println("    无法打开权限:允许程序读取或写入登记check-in数据库属性表的权限     ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.BODY_SENSORS},ENDV_BODY_SENSORS); }
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.READ_CELL_BROADCASTS)) { System.err.println(    "向用户提供请求权限理由"); Snackbar.make(mLayout,"     <!--传感器权限-->    ",Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.YELLOW) .setAction(R.string.gook, new View.OnClickListener() { @ Override public void onClick(View view) {System.err.println("    请求权限: <!--传感器权限-->    "); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.    READ_CELL_BROADCASTS},    ENDV_READ_CELL_BROADCASTS); } }) .show();  } else {System.err.println("    无法打开权限: <!--传感器权限-->    ");Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show(); System.err.println("发送请求结果"    ); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.READ_CELL_BROADCASTS},ENDV_READ_CELL_BROADCASTS); }



//
//        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.CAMERA)) {
//            System.err.println("向用户提供请求权限理由");
//            Snackbar.make(mLayout, R.string.camera_access_required,Snackbar.LENGTH_INDEFINITE)
//                    .setActionTextColor(Color.YELLOW)
//                    .setAction(R.string.gook, new View.OnClickListener() {
//                        @Override
//                        public void onClick(View view) {
//                            System.err.println("请求去打相机权限:");
//                            ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.CAMERA}, PERMISSION_REQUEST_CAMERA);
//                        } }) .show();
//        } else {
//            System.err.println("无法打开相机");
//            Snackbar.make(mLayout, R.string.camera_unavailable, Snackbar.LENGTH_SHORT).show();
//            // 请求许可。结果将在 onRequestPermissionResult()收到.
//            System.err.println("发送请求结果:");
//            ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.CAMERA}, PERMISSION_REQUEST_CAMERA);
//
//        }





    }

    private void startCamera() {
        Intent intent = new Intent(this, CameraPreviewActivity.class);
        startActivity(intent);
    }

}

 

标签:10,show,Snackbar,make,ENDV,LENGTH,怎样才能,mLayout,android
来源: https://www.cnblogs.com/endv/p/12163924.html