BigDX
BigDX

Reputation: 3547

Trying to launch a activity from my app but keep getting permission denied

I have a launcher theme app that allows user to apply themes from my app.

I am trying to open an activity of a launcher but keep getting permission denied.

This is my intent (i have tried it many different ways)

final Intent intent = new Intent(Intent.ACTION_MAIN, null);
        intent.addCategory(Intent.CATEGORY_LAUNCHER);
        final ComponentName cn = new ComponentName("com.tsf.shell", "com.tsf.shell.theme.ThemeManagerActivity");
        intent.setComponent(cn);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity( intent);

here is the logcat of the error

04-13 00:08:28.738: I/ActivityManager(710): START {act=com.tsf.shell cat=[android.intent.category.LAUNCHER] cmp=com.tsf.shell/.theme.ThemeManagerActivity u=0} from pid 20328
04-13 00:08:28.738: W/ActivityManager(710): Permission denied: checkComponentPermission() owningUid=10006
04-13 00:08:28.738: D/AndroidRuntime(20328): Shutting down VM
04-13 00:08:28.738: W/dalvikvm(20328): threadid=1: thread exiting with uncaught exception (group=0x40eee438)
04-13 00:08:28.738: W/ActivityManager(710): Permission Denial: starting Intent { act=com.tsf.shell cat=[android.intent.category.LAUNCHER] cmp=com.tsf.shell/.theme.ThemeManagerActivity } from ProcessRecord{42df8758 20328:bigdx.tabs/u0a47} (pid=20328, uid=10047) not exported from uid 10006
04-13 00:08:28.748: E/AndroidRuntime(20328): FATAL EXCEPTION: main
04-13 00:08:28.748: E/AndroidRuntime(20328): java.lang.SecurityException: Permission Denial: starting Intent { act=com.tsf.shell cat=[android.intent.category.LAUNCHER] cmp=com.tsf.shell/.theme.ThemeManagerActivity } from ProcessRecord{42df8758 20328:bigdx.tabs/u0a47} (pid=20328, uid=10047) not exported from uid 10006

Are there certain activities that cannot be started from other apps?

this is the manifest from the actual launcher im trying to start

<?xml version="1.0" encoding="utf-8"?>
<manifest android:versionCode="33" android:versionName="1.9.9 Beta" android:installLocation="internalOnly" package="com.tsf.shell"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <original-package android:name="com.tsf.shell" />
    <application android:label="@string/app_name" android:icon="@drawable/tsf_ico" android:name=".ShellApplication" android:persistent="true" android:debuggable="true">
        <activity android:theme="@style/AppTheme" android:name=".Home" android:process="com.tsf.shell" android:taskAffinity="com.tsf.shell" android:stateNotNeeded="true" android:launchMode="singleTask" android:screenOrientation="nosensor" android:configChanges="locale|mcc|mnc|keyboard|keyboardHidden|orientation|uiMode|screenSize" android:allowTaskReparenting="true" 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" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:theme="@style/Theme.Translucent" android:name=".plugin.widgetpicker.ShortcutsPicker" android:process=":shortcutPicker" />
        <activity android:theme="@style/Theme.Translucent" android:name=".plugin.widgetpicker.AppWidgetPicker" android:process=":widgetPicker" />
        <activity android:theme="@style/DialogTheme" android:name=".plugin.iconpicker.IconPicker" android:process=":iconPicker" />
        <activity android:theme="@style/Theme.Translucent" android:name=".VersionDetailActivity" android:process=":versionDetail" />
        <activity android:theme="@style/NoTitleBar" android:name=".theme.ThemeManagerActivity" android:process=":themes" />
        <activity android:theme="@style/NoTitleBar" android:name=".theme.ThemeDetailedActivity" android:process=":themes" />
        <activity android:theme="@style/Theme.Translucent" android:name=".activity.PhotoSelectorActivity" />
        <activity android:name=".preference.SettingPreferenceActivity" />
        <activity android:name=".preference.SettingDrawerPreferenceActivity" />
        <activity android:name=".preference.SettingDockPreferenceActivity" />
        <activity android:theme="@style/NoTitleBar" android:name=".action.ActionSelector" android:process=":gesture" />
        <activity android:name=".preference.SettingGesturePreferenceActivity" android:process=":gesture" />
        <activity android:theme="@style/NoTitleBar" android:name=".usermanual.TSFUserManualActivity" android:process=":UserManual" />
        <activity android:theme="@style/Theme.NoTitleBar.NoBackground" android:name=".RestartActivity" android:process=":restart" android:launchMode="singleTask" android:configChanges="keyboard|keyboardHidden|orientation" />
        <activity android:label="@string/pick_wallpaper" android:icon="@drawable/tsf_ico" android:name=".ShellWallpaperSelector" android:process=":wallpaperSelector" android:launchMode="singleTask" android:screenOrientation="nosensor" android:finishOnCloseSystemDialogs="true">
            <intent-filter>
                <action android:name="android.intent.action.SET_WALLPAPER" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <service android:name=".services.ForegroundService" android:enabled="true">
            <intent-filter>
                <action android:name="com.tsf.shell.services.FOREGROUND" />
            </intent-filter>
        </service>
        <provider android:name="com.tsf.shell.ShellProvider" android:readPermission="com.tsf.shell.permission.READ_SETTINGS" android:writePermission="com.tsf.shell.permission.WRITE_SETTINGS" android:authorities="com.tsf.shell.settings" />
    </application>
    <supports-screens android:anyDensity="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" />
    <uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.READ_LOGS" />
    <uses-permission android:name="com.android.vending.CHECK_LICENSE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.PERSISTENT_ACTIVITY" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.RESTART_PACKAGES" />
    <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
    <uses-permission android:name="android.permission.SET_WALLPAPER" />
    <uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-feature android:name="android.hardware.telephony" android:required="false" />
    <uses-feature android:name="android.hardware.bluetooth" android:required="false" />
    <uses-feature android:name="android.hardware.location" android:required="false" />
    <uses-feature android:name="android.hardware.location.network" android:required="false" />
    <uses-feature android:name="android.hardware.location.gps" android:required="false" />
    <uses-feature android:glEsVersion="0x20000" android:required="true" />
</manifest>

Upvotes: 4

Views: 3347

Answers (1)

stinepike
stinepike

Reputation: 54682

The problem is not in your calling application. It seems the problem is in the called application. Check whether the receiver where the called application is receiving the intent is exported. use

android:exported="true"

from the doc of android:exported

Whether or not the broadcast receiver can receive messages from sources outside its application — "true" if it can, and "false" if not. If "false", the only messages the broadcast receiver can receive are those sent by components of the same application or applications with the same user ID.

Upvotes: 3

Related Questions