Android默认给予USB读写权限,去掉授权对话框

去掉USB读写权限授权对话框:
要授权 ES文件浏览器 访问您 *** 上的数据 (包括照片和视频)吗?

修改:

--- a/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/OpenExternalDirectoryActivity.java
+++ b/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/OpenExternalDirectoryActivity.java
@@ -454,6 +454,17 @@ public class OpenExternalDirectoryActivity extends Activity {
                     mActivity.finish();
                 }
             };
+                       // Auto granted
+                       String pkgName = mActivity.getCallingPackage();
+                       android.util.Log.i("AZ", "GRANT.CallingPackage=" + pkgName);
+                       if("com.dachen.openlive".equals(pkgName)
+                || "com.dachen.openmeeting".equals(pkgName)
+                || "com.estrongs.android.pop".equals(pkgName)){
+                               Intent intent = createGrantedUriPermissionsIntent(mActivity, mActivity.getExternalStorageClient(), mFile);
+                               logValidScopedAccessRequest(mActivity, directory, SCOPED_DIRECTORY_ACCESS_GRANTED);
+                mActivity.setResult(RESULT_OK, intent);
+                               mActivity.finish();
+                       }
             @SuppressLint("InflateParams")
             // It's ok pass null ViewRoot on AlertDialogs.

你可能感兴趣的:(Android)