1. 程式人生 > >BaseActivity關於Android6.0以後的許可權問題封裝

BaseActivity關於Android6.0以後的許可權問題封裝

詳細許可權問題的原始碼封裝,直接就能用


import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;

/**
 * @author Admin
 * @version $Rev$
 * @des ${TODO}
 * @updateAuthor $Author$
 * @updateDes ${TODO}
 */
public class BaseActivity extends AppCompatActivity {
    //**************** Android M Permission (Android 6.0許可權控制程式碼封裝)
    private int permissionRequestCode = 88;
    private PermissionCallback permissionRunnable;

    public interface PermissionCallback {
        void hasPermission();

        void noPermission();
    }

    /**
     * Android M執行時許可權請求封裝
     *
     * @param permissionDes 許可權描述
     * @param runnable      請求許可權回撥
     * @param permissions   請求的許可權(陣列型別),直接從Manifest中讀取相應的值,比如Manifest.permission.WRITE_CONTACTS
     */
    public void performCodeWithPermission(@NonNull String permissionDes, PermissionCallback runnable, @NonNull String... permissions) {
        if (permissions == null || permissions.length == 0)
            return;
        //        this.permissionrequestCode = requestCode;
        this.permissionRunnable = runnable;
        if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.M) || checkPermissionGranted(permissions)) {
            if (permissionRunnable != null) {
                permissionRunnable.hasPermission();
                permissionRunnable = null;
            }
        } else {
            //permission has not been granted.
            requestPermission(permissionDes, permissionRequestCode, permissions);
        }

    }

    private boolean checkPermissionGranted(String[] permissions) {
        boolean flag = true;
        for (String p : permissions) {
            if (ActivityCompat.checkSelfPermission(this, p) != PackageManager.PERMISSION_GRANTED) {
                flag = false;
                break;
            }
        }
        return flag;
    }

    private void requestPermission(String permissionDes, final int requestCode, final String[] permissions) {
        if (shouldShowRequestPermissionRationale(permissions)) {
            /*1. 第一次請求許可權時,使用者拒絕了,下一次:shouldShowRequestPermissionRationale()  返回 true,應該顯示一些為什麼需要這個許可權的說明
            2.第二次請求許可權時,使用者拒絕了,並選擇了“不在提醒”的選項時:shouldShowRequestPermissionRationale()  返回 false
            3. 裝置的策略禁止當前應用獲取這個許可權的授權:shouldShowRequestPermissionRationale()  返回 false*/
            // Provide an additional rationale to the user if the permission was not granted
            // and the user would benefit from additional context for the use of the permission.
            // For example, if the request has been denied previously.

            //            Snackbar.make(getWindow().getDecorView(), requestName,
            //                    Snackbar.LENGTH_INDEFINITE)
            //                    .setAction(R.string.common_ok, new View.OnClickListener() {
            //                        @Override
            //                        public void onClick(View view) {
            //                            ActivityCompat.requestPermissions(BaseAppCompatActivity.this,
            //                                    permissions,
            //                                    requestCode);
            //                        }
            //                    })
            //                    .show();
            //如果使用者之前拒絕過此許可權,再提示一次準備授權相關許可權
            new AlertDialog.Builder(this)
                    .setTitle("提示")
                    .setMessage(permissionDes)
                    .setPositiveButton("授權", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            ActivityCompat.requestPermissions(BaseActivity.this, permissions, requestCode);
                        }
                    }).show();

        } else {
            // Contact permissions have not been granted yet. Request them directly.
            ActivityCompat.requestPermissions(BaseActivity.this, permissions, requestCode);
        }
    }

    private boolean shouldShowRequestPermissionRationale(String[] permissions) {
        boolean flag = false;
        for (String p : permissions) {
            if (ActivityCompat.shouldShowRequestPermissionRationale(this, p)) {
                flag = true;
                break;
            }
        }
        return flag;
    }

    /**
     * Callback received when a permissions request has been completed.
     */
    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
                                           @NonNull int[] grantResults) {
        if (requestCode == permissionRequestCode) {
            if (verifyPermissions(grantResults)) {
                if (permissionRunnable != null) {
                    permissionRunnable.hasPermission();
                    permissionRunnable = null;
                }
            } else {
                Toast.makeText(this, "暫無許可權執行相關操作!", Toast.LENGTH_SHORT).show();
                if (permissionRunnable != null) {
                    permissionRunnable.noPermission();
                    permissionRunnable = null;
                }
            }
        } else {
            super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        }

    }

    public boolean verifyPermissions(int[] grantResults) {
        // At least one result must be checked.
        if (grantResults.length < 1) {
            return false;
        }

        // Verify that each required permission has been granted, otherwise return false.
        for (int result : grantResults) {
            if (result != PackageManager.PERMISSION_GRANTED) {
                return false;
            }
        }
        return true;
    }
    //********************** END Android M Permission ****************************************
}

使用

package com.yangs.savexmlinfo;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
//重新繼承BaseActivity 這個類(BaseActivity這個類是繼承自AppCompatActivity)
//運用performCodeWithPermission這個方法開始執行許可權的內容
public class MainActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activit);
    }


}

呼叫方法

performCodeWithPermission("攝像頭許可權申請", new PermissionCallback() {
            @Override
            public void hasPermission() {
                // 二維碼掃碼
                Intent intent = new Intent(MainActivity.this, CaptureActivity.class);
                startActivityForResult(intent, Constant.REQ_QR_CODE);
            }
            @Override
            public void noPermission() {
                Toast.makeText(MainActivity.this, "請至許可權中心開啟本應用的相機訪問許可權", Toast.LENGTH_LONG).show();
            }
        }, Manifest.permission.CAMERA);

**

**

Android應用程式在使用很多功能的時候必須在Mainifest.xml中宣告所需的許可權,否則無法執行。下面是一個Mainifest.xml檔案的例子:
 
<?xml version="1.0" encoding="utf-8"?>  
<manifest xmlns:android="http://schemas.android.com/apk/res/android"  
      package="hi.braincol.local.filebrowser"  
      android:versionCode="1"  
      android:versionName="1.0.0">  
 
    <application android:icon="@drawable/icon" android:label="@string/app_name">  
        <activity android:name=".FileBrowser"  
                  android:label="@string/app_name">  
            <intent-filter>  
                <action android:name="android.intent.action.MAIN" />  
                <category android:name="android.intent.category.LAUNCHER" />  
            </intent-filter>  
        </activity>  
    </application>  
 
   <uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER"/>  
   <uses-permission android:name="android.permission.VIBRATE"/>  
 
</manifest> 
 
上面xml檔案中的: <uses-permission android:name=”android.permission.ACCESS_SURFACE_FLINGER”>
就是允許應用程式使用SurfaceFlinger的底層屬性。
  
Android中為應用程式準備了很多可選許可權,下面是Android應用程式許可權清單:
  
android.permission.ACCESS_CHECKIN_PROPERTIES :
Allows read/write access to the “properties” table in the checkin database, to change values that get uploaded.
允許以read/write訪問檢入資料庫(checkin database?)的"properties"表,並且可以更改、更新資料庫。
  
android.permission.ACCESS_COARSE_LOCATION :
Allows an application to access coarse(e.g, Cell-ID, WiFi) location.
允許一個應用程式通過訪問CellID和WiFi熱點等方式獲取粗略的本地位置。
  
android.permission.ACCESS_FINE_LOCATION :
Allows an application to access fine(e.g, GPS) location.
允許一個應用程式通過訪問GPS等方式獲取較精確的本地位置。
  
android.permission.ACCESS_LOCATION_EXTRA_COMMANDS :
Allows an application to access extra location provider commands.
允許一個應用程式訪問(使用)額外的本地位置服務提供者。
  
android.permission.ACCESS_MOCK_LOCATION :
Allows an application to access mock location providers for testing.
允許一個應用程式訪問(建立)模擬的位置服務提供者用於測試。
  
android.permission.ACCESS_NETWORK_STATE :
Allows applications to access information about networks.
允許應用程式訪問(獲取)網路資訊。
  
android.permission.ACCESS_SURFACE_FLINGER :
Allows an application to use SurfaceFlinger’s low level features.
允許一個應用程式使用SurfaceFlinger的底層屬性。(什麼是SurfaceFlinger?)
  
android.permission.ACCESS_WIFI_STATE :
Allows applications to access information about Wi-Fi networks.
允許應用程式獲取Wi-Fi網路的資訊)。
  
android.permission.ACCOUNT_MANAGER :
Allows an applications to call into AccountAuthenticators.
允許一個應用程式啟動賬戶認證。
 
android.permission.AUTHERTICATE_ACCOUTS :
Allows an applicatons to act as an AccoutAuterticator for the AccoutManger.
允許一個應用程式充當賬戶認證管理者。
 
android.permission.BATTERY_STATS :
Allows an application to collect battery statistics.
允許一個應用程式獲取電池使用的統計資訊(剩餘電量、電池的耗電情況(各主要應用程式耗電佔總耗電的百分比等)等)。
 
android.permission.BIND_APPWIGET :
Allows an application to tell the AppWiget service which application can access AppWiget data.
允許一個應用程式告知AppWiget服務:我(當前應用程式)可以訪問AppWiget資料。
 
android.permission.BIND_DEVICE_ADMIN :
Must be required by device administration receiver, to ensure that only the system can interact with it.
裝置管理服務必須擁有的許可權,確保只有系統可以通過裝置管理服務與裝置進行互動(訪問裝置,資料互動)。
 
android.permission.BIND_INPUT_METHOD :
Must be required by an InputMethodService, to ensure that only the system can bind to it.
輸入法服務(InputMethodService)必須擁有的許可權,確保只有系統可以繫結之。
 
android.permission.BIND_WALLPAPER : 
Must be required by a WallpaperService, to ensure that only the system can bind to it.
桌面服務(WallpaperService)必須擁有的許可權,確保只有系統才可以繫結之.
 
android.permission.BLUETOOTH :
Allows applications to connect to paired buletooth devices.
允許應用程式連線到已配對的藍芽裝置(遠端藍芽,非本機藍芽)。
 
android.permission.BULETOOTH_ADMIN : 
Allows applications to discover an pair bluetooth devices.
允許應用程式搜尋並且配對藍芽裝置。
 
android.permission.BRICK :
Required to be able to disable the device (very dangrous!).
禁用裝置必須擁有的許可權(危險,慎用!)。
 
android.permission.BROADCAST_PACKAGE_REMOVED :
Allows an application to boradcast a notification that an application package has been removed.
允許一個應用程式廣播“一個(不是同一個)應用程式包已經被移除”的通告。(指一個應用程式已被卸裝的通告?)
 
android.permission.BROADCAST_SMS : 
Allows an application to broadcast an SMS receipt notification.
允許一個應用程式廣播一個簡訊回執(如:帥哥,你有一條新的短訊息!)的通告。
 
android.permission.BROADCAST_STICKY :
Allows an application to broadcast sticky intents.
允許一個應用程式廣播常用(sticky?) intents.
 
android.permission.WAP_PUSH :
Allows an application to broadcast a WAP PUSH receipt notification.
允許一個應用程式廣播WAP PUSH回執通告。
說明:WAP-PUSH,WAP推送簡訊,是一種特殊格式的簡訊。WAP-PUSH可以將某一站點或某一業務的連結通過短息傳送到支援WAP的裝置,WAP PUSH實現了簡訊和WAP業務的結合。
 
android.permission.CALL_PHONE : 
Allows an application to initiate a phone call without going through the Dialer user interface for the user to confirm the call being placed.
允許應用程式不經過使用者撥號介面而直接撥號。
 
android.permission.CALL_PRIVILEGED :
Allows an application to call any phone number, including emergency numbers, without going througth the Dialer user interface for confirm the call being palced.
允許應用程式不經過使用者撥號介面而撥打任意號碼(包括緊急號碼)。(緊急號碼是指哪些?)
 
android.permission.CAMERA :
Required to be able to access the camera device.
訪問攝像頭裝置必須具備的許可權。
 
android.permission.CHANGE_COMPONENT_ENABLED_STATE : 
Allows an application to change whether an application component (other than its own) is enabled or not.
允許一個應用程式改變另一個應用程式元件的啟用狀態(禁用或啟用)。
 
android.permission.CHANGE_NETWORK_STATE :
Allows applications to change network connecitity state.
允許應用程式更改網路連線狀態。
 
android.permission.CHANGE_WIFIMULTICAST_STATE :
Allows applications to enter Wi-Fi Multicast mode.
允許應用程式進入Wi-Fi Multicast 模式。
說明:Multicast,多重廣播,網路中的一個節點發出的資訊被多個節點接收。
 
android.permission.CHANGE_WIFI_STATE :
Allows applications to change Wi-Fi connectivity state.
允許應用程式更改Wi-Fi連線狀態。
 
android.permission.CLEAR_APP_CACHE :
Allows an application to clear the caches of all installed application on the device.
允許一個應用程式清理所有已安裝程式的裝置緩衝區 (是安裝的時候使用的緩衝區,還是執行時候的緩衝區?)
 
android.permission.CLEAR_APP_USER_DATA : 
Allows an application to clear user data.
允許一個應用程式清理使用者資料。
 
android.perimmision.CONTROL_LOCATION_UPDATES :
Allows enabling/disabling location update notification from the radio.
允許啟用/禁用位置更新的提示資訊。(from the radio? 通過電波獲得的位置更新資訊?)
 
android.permission.DELETE_CACHE_FILES :
Allows an application to delete cache files.
允許一個應用程式刪除cache檔案。
 
android.permission.DLEETE.PACKAGES :
Allows an application to delete packages.
允許一個應用程式刪除packages(apk安裝包?還是所有型別的壓縮包?)
 
android.permission.DEVICE_POWER :
Allows low-level access to power management.
允許訪問底層的電源管理。
 
android.permission.DIAGNOSTIC :
Allows application to RW to diagnostic resources.
允許應用程式讀寫診斷資源(diagnostic resources)。(什麼事diagnostic resources?診斷資訊,log?)
 
android.permission.DISABLE_KEYGUARD :
Allows aplications to disable the keyguard.
允許應程式禁用鍵盤鎖。
 
android.permission.DUMP :
Allows an application to retrieve state dump information from system services.
允許一個應用程式從系統服務中抓取(檢索)狀態轉儲資訊。(什麼是state dump?將資料從一個裝置轉存到另外一個裝置?)
 
android.permission.EXPAND_STATUS_BAR :
Allows an applicaton to expand or collapse the status bar.
允許一個應用程式擴張或收縮狀態列。
 
android.permission.FACTORY_TEST :
Run as an manufacturer test application, running as the root user.
允許像廠家測試程式那樣以root使用者許可權執行應用程式。
 
android.permission.FLSHLIGHT :
Allows access to the flashlight.
允許訪問閃光訊號燈。
 
android.permission.FORCE_BACK :
Allows an application to force a BACK operation on whatever is the top activity.
允許一個應用程式在activity上強制執行一個回退操作,無論這個activity是否是頂層的activity。
 
android.permission.GET_ACCOUNTS :
Allows access to the list of accouts in the Accounts Service.
允許訪問賬號服務的賬號列表。
 
android.permission.GET_PACKAGE_SIZE :
Allows an application to find out the space used by any package.
允許應用程式獲得任何package佔用的儲存空間。
 
android.permission.GET_TASKS :
Allows an appllication to get information about the currently or recently running tasks: a thumbnail representation of the tasks ,what activities are running in it, etc.
允許一個應用程式獲得的當前或最近執行的任務資訊:像在任務中運行了哪些activitys等一些簡簡訊息。
 
android.permission.GLBOAL_SEARCH :
This permission can be used on content providers to allow the global search system to access their data.
擁有該許可權的content providers將允許全域性搜尋系統訪問其資料。
 
android.permission.HARDWARE_TEST :
Allows access to hardware peripherals.
允許訪問外設。
 
android.permission.INJECT_EVENTS :
Allows an application to inject user events (keys, touch, trackball) into the event stream and deliver them to ANY window.
允許一個應用程式向事件流(事件佇列)注入使用者事件(keys,touch,tarckball),並且將其傳遞給視窗。
 
android.permission.INSTALL_LOCATION_PROVIDER :
Allows an application to install a locaton provider int the location Manager.
允許應用程式程式安裝一個位置服務到位置管理器。
 
androd.permission.INSTALL_PCAKAGES :
Allows an application to install packages.
允許一個應用程式安裝packages。(用於版本升級的?)
 
android.permission.INTERNAL_SYSTEM_WINDOW :
Allows an application to open windows that are for use by parts of the system user interface.
允許一個應用程式開啟系統使用者介面中的視窗。
 
android.permission.INTERNET :
Allows application to open networkd sockets.
允許應用程式開啟網路套接字(sockets)。
 
android.permission.KILL_BACKGROUND_PROCESSES :
Allows an application to call killBackgroundProcesses(String).
允許應用程式呼叫killBackgroundProcesses(String)方法。
 
android.permission.MANAGE_ACCOUNTS :
Allows an application to manage the list of accouts in the AccountManager.
允許應用程式管理AccountManager中的賬戶列表。
 
android.permission.MANAGE_APP_TOKENS :
Allows an application to manage (create, destroy, Z-order) application tokens in the window manager.
允許一個應用程式管理(建立、銷燬、Z-order)在視窗管理器中的應用程式圖示。
 
android.permission.MASTER_CLEAR:
none.
沒任何描述。
 
android.permisson.MODIFY_AUDIO_SETTINGS :
Allows an application to modify global audio settings.
允許一個應用程式更改全域性音訊設定。
 
android.permission.MODIFY_PHONE_STATE :
Allows modification of the telephony state – power on, mmi, etc.
允許修改電話(手機?)狀態——上電,人機介面(mmi,Man Machine Interface)等。 
 
android.permission.MOUNT_FORMAT_FILESYSTEMS :
Allows formatting file sysytems for removable storage.
允許格式化移動儲存裝置。
 
android.permission.MOUNT_UNMOUNT_FILESYSYTEMS : 
Allows mounting and unmounting the file sysytems for removable storage.
允許載入或解除安裝移動儲存裝置。
 
android.permission.FERSISTENT_ACTIVITY : 
Allows an application to make its activities persistent.
允許一個應程式設定其activities具有永續性(persistent activities是什麼樣的activites?)。
 
android.permission.PROCESS_OUTGOING_CALLS :
Allows an application to monitor, modify, or abort outgoing calls.
允許應用程式監視、修改、忽略撥出的電話(撥號)。
 
android.permission.READ_CALENDAR :
Allows an application to read the user’s calendar data.
允許一個應用程式讀取使用者日曆資料。
 
android.permission.READ_CONTACTS :
Allows an apllication to read the user’s contacts data.
允許一個應用程式讀取使用者聯絡人列表。
 
android.permission.READ_FRAME_BUFFER :
Allows an application to take screen shots and more generally get access to the frame buffer data.
允許一個應用程式通過訪問幀緩衝區(一般一屏就是一幀)獲取螢幕截圖等幀資料。
 
android.permission.READ_HISTORY_BOOKMARKS :
Allows an application to read (but not write) the user’s browsing history and bookmarks.
允許一個應用程式讀取瀏覽器的歷史記錄和書籤。
 
android.permission.READ_INPUT_STATE :
Allows an application to retrieve the current state of keys and switches.
允許一個應用程式獲取當前keys和switches的狀態(keys、switchs都是輸入裝置)。
 
android.permission.READ_LOGS :
Allows an application to read the low-level system log files.
允許一個應用程式讀取底層系統的log檔案。
 
android.permission.READ_OWNER_DATA :
Allows an application to read the owner’s data.
允許一個應用程式讀取所有者的資料。(手機的owner?)
 
android.permission.READ_PHONE_STATE :
Allows read only access to phone state.
允許讀取(不可寫)手機狀態。
 
android.permission.READ_SMS :
Allows an application to read SMS messages.
允許一個應用程式讀取手機短訊息。
 
android.permission.READ_SYNC_SETTING :
Allows applications to read the sync setting.
允許應用程式讀取同步設定
 
android.permission.READ_SYNC_STATS :
Allows applications to read sync stats.
允許一個應用程式讀取同步狀態。
 
android.permission.REBOOT :
Required to be able to reboot the device.
重啟裝置必須具有的許可權。
 
android.permission.RECEIVE_BOOT_COMPLETED :
Allows an application to receive the ACTION_BOOT_COMPLETED that is boradcast after the sysytem finishes booting.
允許應用程式獲取系統完全啟動之後的ACTION_BOOT_COMPLETED廣播。
 
android.permission.RECEIVE_MMS :
Allows an application to monitor incoming MMS messages, to record or perform processing on them.
允許一個應用程式監控收到的彩信(MMS),記錄或處理之。
 
android.permission.RECEIVE_SMS :
Allows an application to monitor incoming SMS messages, to record or perform processing on them.
允許一個應用程式監控收到的簡訊(SMS),記錄或處理之。
 
android.permission.RECEIVE_WAP_PUSH :
Allows an application to monitor incoming WAP push messages.
允許一個應用程式監測接受的WAP-PSUH訊息。
 
android.permission.RECORD_AUDIO : 
Allows an application to record audio.
允許一個應用程序錄音。
 
android.permission.REORERD_TASKS :
Allows an application to change the Z-order of tasks.
允許一個應用程式改變任務的Z-order(類似於優先順序?)。
 
android.permission.RESTART_PACKAGES :
This constant is deprecated. The restartPackage(String) API is no longer supported.
這個常量已不再使用,restartPackage這個API函式不再有效。
 
android.permission.SEND_SMS : 
Allows an application to send SMS messages.
允許應用程式傳送短訊息(SMS)。
 
android.permission.SET_ACTIVITY_WATHCER :
Allows an application to watch and control how activities are started globally in system.
允許一個應用程式在全域性系統中監控activities是如何被啟動的。
 
android.permission.SET_ALWAYS_FINISH :
Allows an application to control whether activities are immediately finished when put in the background.
允許應用程式無論activies是否剛剛結束,都將應用程式置於後臺執行。(強制結束activies,置應用程式於後臺執行?)
 
android.permission.SET_ANIMATION_SCALE :
Modify the global animation scaling factor.
修改全域性動畫縮放比例。
 
android.permission.SET_DEBUG_APP :
Configure an application for debugging.
為除錯配置一個應用程式。
 
android.permission.SET_ORIENTATION :
Allows low-level access to setting the orientation (actually rotation) of the screen.
允許設定螢幕方向(實際上就是旋轉螢幕)。
 
android.permission.SET_PREFERRED_APPLICATIONS :
This constant is deprecated, No longer useful, see addPackageToPreferred(String)for details.
這個常量已經無效了。
 
android.permission.SET_PROCESS_LIMIT :
Allows application to set the maximum number of (not needed) application processes that can be runing.
允許應用程式設定最大可用程序數(不是必須的)。
 
android.permission.SET_TIME :
Allows applications to set the system time.
允許應用程式設定系統時間。
 
android.permission.SET_TIME_ZONE :
Allows applications to set the system time zone.
允許應用程式設定系統時區。
 
android.permission.SET_WALLPAPER :
Allows applications to set the wallpaper.
允許應用程式設定桌面。
 
android.permission.SET_WALLPAPER_HINTS : 
Allows application to set wallpaper hints.
允許應用程式設定桌面提示。(wallpaper hints 是什麼東東?) 
 
android.permission.SINGAL_PERSISTENT_PROCESSES :
Allows an application to request that a signal be sent to all persistent processes.
允許應用程式請求一個傳送給所有持續程序的訊號(signal)。(persistent processes 是什麼樣的程序?)
 
android.permission.STATUS_BAR :
Allows an application to open, close, or disable the status bar and its icons.
允許一個應用程式開啟、關閉、禁用狀態列和狀態列圖示。
 
android.permission.SUBSCRIBED_FEEDS_READ :
Allows an application to allow access the subscribed feeds ContentProvider.
允許一個應用程式訪問訂閱RSS feeds的ContentProvider。
 
android.permission.SUBSRIBED_FEEDS_WRITE :
None.
沒有任何描述。
 
android.permission.SYSYTEM_ALERT_WINDOW : 
Allows an application to open windows using the type TYPE_SYSTEM_ALERT, show on top of all other applications.
允許應用程式開啟一個TYPE_SYSTEM_ALERT型別的系統警告(提示)視窗, 並將其置於頂層顯示。
 
android.permission.UPDATE_DEVICE_STATS :
Allows an application to update device statistics.
允許應用程式更新裝置統計資訊。
 
android.permission.USE_CREDENTIALS :
Allows an application to request authtokens from the AccountManager.
允許一個應用程式向AccountManager申請授權標記。
 
android.permission.VIBRATE :
Allows access to the vibrator.
允許訪問振動器。
 
android.permission.WAKE_LOCK :
Allows using PowerManager WakeLocks to keep processor from sleeping or screen from dimming.
允許使用PowerManager WakeLocks,避免處理器進入休眠,或螢幕變暗。
 
android.permission.WRITE_APN_SETTINGS :
Allows applications to write the apn settings.
允許應用程式設定APN。
說明:APN(Acess Point Name)即“接入點名稱”,用來標識GPRS的業務種類,目前分為兩大類: CMWAP(通過GPRS訪問WAP業務)、CMNET(除了WAP以外的服務目前都是CMNET,比如連線因特網等)。
 
android.permission.WRITE_CALENDAR :
Allows an application to write (but not read) the user’s calendar data.
允許應用程式只寫使用者日曆資料。
 
android.permission.WRITE_CONTACTS :
Allows an application to write (but not read) the user’s contacts data.
允許應用程式只寫使用者聯絡人資料。
 
android.permission.WRITE_EXTERNAL_STORAGE :
Allows an application to write to external storage.
允許應用程式寫資料到外部儲存裝置(主要是SD卡)。
 
android.permission.WRITE_GSERVICES :
Allows an application to modify the Google service map.
允許應用程式修改google地圖服務。
 
android.permission.WRITE_HISTORY_BOOKMARKS :
Allows an application to write (but not read) the user’s browsing history and bookmarks.
允許一個應用程式寫資料到使用者瀏覽器歷史記錄和書籤。
 
android.permission.WRITE_OWNER_DATA :
Allows an application to write (but not read) the owner’s data.
允許一個應用程式寫入(填入)所有者(手機所有者?)的資訊。
 
android.permission.WRITE_SECURE_SETTINGS :
Allows an application to read or write the secure system settings.
允許一個應用程式讀寫系統安全設定。
 
android.permission.WRITE_SETTINGS :
Allows an application to read or write the system setting.
允許一個應用程式讀寫系統設定。
 
android.permission.WRITE_SMS :
Allows an application to write SMS messages.
允許一個應用程書寫短訊息。
 
android.permisson.WRITE_SYNC_SETTING :