Application crash error. Com.android.launcher3.permission.WRITE_SETTINGS or grantUriPermission required

Hello I am working on a launcher which is based on ASOP launcher3 form, it only works on all my devices that do not work cyanogenmod when I try to install it on a device that runs cyanogenmod it downloads for a minute and then crashes

Here's what logcat says:

05-03 10:32:26.665: E/AndroidRuntime(9845): FATAL EXCEPTION: launcher-loader
05-03 10:32:26.665: E/AndroidRuntime(9845): Process: com.d4a.tobiasnow, PID: 9845
05-03 10:32:26.665: E/AndroidRuntime(9845): java.lang.SecurityException: Permission Denial: writing com.android.launcher3.LauncherProvider uri content://com.android.launcher3.settings/favorites/18?notify=false from pid=9845, uid=10093 requires com.android.launcher3.permission.WRITE_SETTINGS, or grantUriPermission()
05-03 10:32:26.665: E/AndroidRuntime(9845):     at android.os.Parcel.readException(Parcel.java:1546)
05-03 10:32:26.665: E/AndroidRuntime(9845):     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185)
05-03 10:32:26.665: E/AndroidRuntime(9845):     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
05-03 10:32:26.665: E/AndroidRuntime(9845):     at android.content.ContentProviderProxy.update(ContentProviderNative.java:568)
05-03 10:32:26.665: E/AndroidRuntime(9845):     at android.content.ContentResolver.update(ContentResolver.java:1333)
05-03 10:32:26.665: E/AndroidRuntime(9845):     at com.d4a.tobaisnow.LauncherModel$5.run(LauncherModel.java:526)
05-03 10:32:26.665: E/AndroidRuntime(9845):     at android.os.Handler.handleCallback(Handler.java:739)
05-03 10:32:26.665: E/AndroidRuntime(9845):     at android.os.Handler.dispatchMessage(Handler.java:95)
05-03 10:32:26.665: E/AndroidRuntime(9845):     at android.os.Looper.loop(Looper.java:135)
05-03 10:32:26.665: E/AndroidRuntime(9845):     at android.os.HandlerThread.run(HandlerThread.java:61)

      

I guess this is the problem that is in my manifest file in my project

so here is my manifest code:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.d4a.tobiasnow"
    android:versionCode="2"
    android:versionName="1.1" >

    <uses-sdk
        android:minSdkVersion="16"
        android:targetSdkVersion="19" />

     <permission
        android:name="com.android.launcher3.permission.PRELOAD_WORKSPACE"
        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
        android:protectionLevel="system|signature" />
    <permission
        android:name="com.android.launcher.permission.INSTALL_SHORTCUT"
        android:description="@string/permdesc_install_shortcut"
        android:label="@string/permlab_install_shortcut"
        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
        android:protectionLevel="dangerous" />
    <permission
        android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT"
        android:description="@string/permdesc_uninstall_shortcut"
        android:label="@string/permlab_uninstall_shortcut"
        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
        android:protectionLevel="dangerous" />
    <permission
        android:name="com.d4a.tobiasnow.permission.READ_SETTINGS"
        android:description="@string/permdesc_read_settings"
        android:label="@string/permlab_read_settings"
        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
        android:protectionLevel="normal" />
    <permission
        android:name="com.d4a.tobiasnow.permission.WRITE_SETTINGS"
        android:description="@string/permdesc_write_settings"
        android:label="@string/permlab_write_settings"
        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
        android:protectionLevel="normal" />
    <permission
        android:name="com.d4a.tobiasnow.permission.RECEIVE_LAUNCH_BROADCASTS"
        android:protectionLevel="signature" />

    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.SET_WALLPAPER" />
    <uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.BIND_APPWIDGET" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.android.launcher.permission.READ_SETTINGS" />
    <uses-permission android:name="com.android.launcher.permission.WRITE_SETTINGS" />
    <uses-permission android:name="com.android.launcher3.permission.READ_SETTINGS" />
    <uses-permission android:name="com.android.launcher3.permission.WRITE_SETTINGS" />
    <uses-permission android:name="com.android.launcher3.permission.RECEIVE_LAUNCH_BROADCASTS" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.SET_WALLPAPER" />
    <uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.CALL_PRIVILEGED" />
    <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
    <uses-permission android:name="android.permission.READ_CALL_LOG" />
    <uses-permission android:name="android.permission.WRITE_CALL_LOG" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />


    <application
        android:name="com.d4a.tobaisnow.LauncherApplication"
        android:hardwareAccelerated="true"
        android:configChanges="orientation"
        android:icon="@mipmap/ic_launcher_home"
        android:label="@string/application_name"
        android:largeHeap="@bool/config_largeHeap"
        android:supportsRtl="true" >
        <activity
            android:name="com.d4a.tobaisnow.Launcher"
            android:clearTaskOnLaunch="true"
            android:launchMode="singleTask"
             android:screenOrientation="portrait"
            android:stateNotNeeded="true"
            android:theme="@style/Theme"
            android:windowSoftInputMode="adjustPan" >

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.HOME" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.MONKEY" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.d4a.tobaisnow.ToggleWeightWatcher"
            android:enabled="@bool/debug_memory_enabled"
            android:icon="@mipmap/ic_launcher_home"
            android:label="@string/toggle_weight_watcher"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
          <activity android:name="dialer2.DialerActivity"
                      android:screenOrientation="portrait">
        </activity>

          <activity android:name="dialer2.FragmentTab3"
                      android:screenOrientation="portrait">
        </activity>
        <activity
            android:name="com.d4a.tobaisnow.WallpaperPickerActivity"
            android:finishOnCloseSystemDialogs="true"
            android:icon="@mipmap/ic_launcher_wallpaper"
            android:label="@string/pick_wallpaper"
            android:process=":wallpaper_chooser"
            android:theme="@style/Theme.WallpaperCropper" 
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.SET_WALLPAPER" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <activity
            android:name="com.d4a.tobaisnow.WallpaperCropActivity"
            android:finishOnCloseSystemDialogs="true"
            android:icon="@mipmap/ic_launcher_wallpaper"
            android:label="@string/crop_wallpaper"
            android:process=":wallpaper_chooser"
            android:theme="@style/Theme.WallpaperCropper" 
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.service.wallpaper.CROP_AND_SET_WALLPAPER" />

                <category android:name="android.intent.category.DEFAULT" />

                <data android:mimeType="image/*" />
            </intent-filter>
        </activity>

        <!-- Debugging tools -->
        <activity
            android:name="com.d4a.tobaisnow.MemoryDumpActivity"
            android:enabled="@bool/debug_memory_enabled"
            android:excludeFromRecents="true"
            android:icon="@mipmap/ic_launcher_home"
            android:label="@string/debug_memory_activity"
            android:theme="@android:style/Theme.NoDisplay" 
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <service
            android:name="com.d4a.tobaisnow.MemoryTracker"
            android:enabled="@bool/debug_memory_enabled" >
        </service>

        <!-- Intent received used to prepopulate the default workspace. -->
        <receiver
            android:name="com.d4a.tobaisnow.PreloadReceiver"
            android:permission="com.android.launcher3.permission.PRELOAD_WORKSPACE" >
            <intent-filter>
                <action android:name="com.android.launcher3.action.PRELOAD_WORKSPACE" />
            </intent-filter>
        </receiver>

        <!-- Intent received used to install shortcuts from other applications -->
        <receiver
            android:name="com.d4a.tobaisnow.InstallShortcutReceiver"
            android:permission="com.android.launcher3.permission.INSTALL_SHORTCUT" >
            <intent-filter>
                <action android:name="com.android.launcher3.action.INSTALL_SHORTCUT" />
            </intent-filter>
        </receiver>

        <!-- Intent received used to uninstall shortcuts from other applications -->
        <receiver
            android:name="com.d4a.tobaisnow.UninstallShortcutReceiver"
            android:permission="com.android.launcher3.permission.UNINSTALL_SHORTCUT" >
            <intent-filter>
                <action android:name="com.android.launcher3.action.UNINSTALL_SHORTCUT" />
            </intent-filter>
        </receiver>

        <!-- New user initialization; set up initial wallpaper -->
        <receiver
            android:name="com.d4a.tobaisnow.UserInitializeReceiver"
            android:exported="false" >
            <intent-filter>
                <action android:name="android.intent.action.USER_INITIALIZE" />
            </intent-filter>
        </receiver>
        <receiver android:name="com.d4a.tobaisnow.PackageChangedReceiver" >
            <intent-filter>
                <action android:name="android.intent.action.PACKAGE_CHANGED" />
                <action android:name="android.intent.action.PACKAGE_REPLACED" />
                <action android:name="android.intent.action.PACKAGE_REMOVED" />

                <data android:scheme="package" >
                </data>
            </intent-filter>
        </receiver>

        <!-- The settings provider contains Home data, like the workspace favorites -->
        <provider
            android:name="com.d4a.tobaisnow.LauncherProvider"
            android:authorities="com.d4a.tobiasnow.settings"
            android:exported="true"
            android:readPermission="com.d4a.tobiasnow.permission.READ_SETTINGS"
            android:writePermission="com.d4a.tobiasnow.permission.WRITE_SETTINGS" />

        <meta-data
            android:name="android.nfc.disable_beam_default"
            android:value="true" />
    </application>

</manifest>

      

I renamed the com.android.launcher3 package in the project to: com.d4a.tobaisnow

I have no idea what the problem is: I tried this issue for 5 hours and no luck

any help / feedback would be awesome!

thanks in advance

Chris

+3


source to share


1 answer


The crash at Runnable

(presumably) at LauncherModel

, line 526. Of course, we really don't know what the code is, since you decided not to provide the crash code.



However, from the stack trace, it appears that you are trying to work with com.android.launcher3.LauncherProvider

ContentProvider

which permission is protected com.android.launcher3.permission.WRITE_SETTINGS

. In the standard version of Launcher3 this is the permissionsignatureOrSystem

. You are not signed with Launcher3 app signing key and presumably your app is not installed on the system partition. Hence, you cannot use this permission.

+1


source







All Articles