Does the installation procedure change the behavior?

I have three applications: University, Student, Staff.

University is the main application. Students and staff is a provider application.

The university has permission to access information from these provider applications.

I installed apk in the next student, staff and university . it works fine

But if I set in order the University, student and staff .

In this case, the university crashes, and the error "permission is denied access."

Why is this happening even if we have the right permission? Why is the provider installed later not available in the main application?

01-29 16:49:48.257: E/AndroidRuntime(2622): Caused by: java.lang.SecurityException: Permission Denial: opening provider com.content.StudentProvider from ProcessRecord{b4849ad0 2622:com.example.University/u0a44} (pid=2622, uid=10044) requires com.content.READ or com.content.WRITE 01-29 16:49:48.257: E/AndroidRuntime(2622): at android.os.Parcel.readException(Parcel.java:1425) 01-29 16:49:48.257: E/AndroidRuntime(2622): at android.os.Parcel.readException(Parcel.java:1379) 01-29 16:49:48.257: E/AndroidRuntime(2622): at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:2354) 01-29 16:49:48.257: E/AndroidRuntime(2622): at android.app.ActivityThread.acquireProvider(ActivityThread.java:4219) 01-29 16:49:48.257: E/AndroidRuntime(2622): at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:1703) 01-29 16:49:48.257: E/AndroidRuntime(2622): at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1099) 01-29 16:49:48.257: E/AndroidRuntime(2622): at android.content.ContentResolver.query(ContentResolver.java:354) 01-29 16:49:48.257: E/AndroidRuntime(2622): at android.content.CursorLoader.loadInBackground(CursorLoader.java:65) 01-29 16:49:48.257: E/AndroidRuntime(2622): at android.content.CursorLoader.loadInBackground(CursorLoader.java:43) 

Supplier - Student - Manifesto

  <permission android:description="@string/readPermissionDescription" android:name="com.content.student.READ" android:protectionLevel="normal"></permission> <permission android:description="@string/writePermissionDescription" android:name="com.content.student.WRITE" android:protectionLevel="dangerous"></permission> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <provider android:name=".StudentProvider" android:authorities="com.content.student" android:readPermission="com.content.student.READ" android:writePermission="com.content.student.WRITE" > </provider> </application> 

University Manifesto

  <uses-permission android:name="com.content.student.READ" /> <uses-permission android:name="com.content.student.WRITE" /> 
+4
source share
1 answer

Why is this happening even if we have the right permission?

Because they were installed in the wrong order.

Why is the provider installed later not available in the main application?

Since there was no permission when the main application was installed.

The solution is to define the same permissions in all three APK files.

In addition, if you do not plan to use third-party applications that can use this content provider, use signature -level permissions, and not normal or dangerous .

+4
source

All Articles