Ask this question elsewhere (like Android Developers, or Stack
Overflow).

This forum is for discussing Android topics, not answering specific
code questions.

On May 24, 2:03 am, "sharon.hou" <[email protected]> wrote:
> Hi,
>
> My application includes  ActivityA / ActivityB / Activity C. Activity
> C is singleTask mode,  not exported, no MAIN/LAUNCHER set,  Activity C
> will be started by ActivityB.
>
> Question:
>  Why un-exported ActivityC can be launched by Launcher
> com.android.launcher which has a common UID=app_25 ?
>
> My understanding it should be denied in startActivityLocked() when
> checking the permission since ActivityC is not exported and the
> aInfo.application.uid will be required to start ActivityC. What's
> wrong in my thought?
>
>    1960         final int perm =
> mService.checkComponentPermission(aInfo.permission, callingPid,
>    1961                 callingUid, aInfo.exported ? -1 :
> aInfo.applicationInfo.uid);
>
> Test steps:
> S1. Launch my app in AppTray.
> S2. Press HomeKey to return to home screen.
> S3. Hold HomeKey to display all Recent launched app, my app can be
> launched successfully ( intent
> cmp=com.example.android.recents/.ActivityB)
> S4. Press Back key to return to home screen.
> S5. Hold HomeKey to display all Recent launched app, my app can be
> launched successfully (intent
> cmp=com.example.android.recents/.ActivityC)
>
> Code:
> The AndroidManifest.xml is as below:
> <?xml version="1.0" encoding="utf-8"?>
> <manifest xmlns:android="http://schemas.android.com/apk/res/android";
>       package="com.example.android.recents"
>       android:versionCode="1"
>       android:versionName="1.0">
>     <application android:icon="@drawable/icon" android:label="@string/
> app_name">
>                 <activity android:name=".ActivityA" />
>
>                 <activity android:name="ActivityC" 
> android:launchMode="singleTask" /
>
>
>
>                 <activity-alias android:name=".ActivityB"
>                         android:targetActivity=".ActivityA">
>                      <intent-filter>
>                          <action
> android:name="android.intent.action.MAIN" />
>                          <category
> android:name="android.intent.category.LAUNCHER" />
>                       </intent-filter>
>                </activity-alias>
>     </application>
>     <uses-sdk android:minSdkVersion="6" />
> </manifest>
>
> ActivityA.java is:
> public class ActivityA extends Activity {
>
>         @Override
>         public void onCreate(Bundle savedInstanceState) {
>                 super.onCreate(savedInstanceState);
>                 startActivity(new Intent(this, ActivityC.class));
>                 finish();
>         }
>
> }
>
> Log:
> app_25    128   32    146840 19264 ffffffff afd0eb08 S
> com.android.launcher
>
> D:\test>adb logcat -v threadtime
> 05-24 16:34:27.065    58   191 I ActivityManager: Starting activity:
> Intent { act=android.intent.action.MAIN
> cat=[android.intent.category.LAUNCHER] flg=0x10200000
> cmp=com.example.android.recents/.ActivityB }
> 05-24 16:34:27.234    58    62 I ActivityManager: Start proc
> com.example.android.recents for activity
> com.example.android.recents/.ActivityB: pid=271 uid=10038 gids={}
> 05-24 16:34:28.753    58   191 I ActivityManager: Starting activity:
> Intent { cmp=com.example.android.recents/.ActivityC }
> 05-24 16:34:29.174    58    88 I ActivityManager: Displayed activity
> com.example.android.recents/.ActivityC: 399 ms (total 2025 ms)
> 05-24 16:34:48.244    58    91 I ActivityManager: Starting activity:
> Intent { act=android.intent.action.MAIN
> cat=[android.intent.category.HOME] flg=0x10200000
> cmp=com.android.launcher/com.android.launcher2.Launcher }
> 05-24 16:34:54.963    58    91 I ActivityManager: Starting activity:
> Intent { act=android.intent.action.MAIN
> cat=[android.intent.category.HOME] flg=0x10200000
> cmp=com.android.launcher/com.android.launcher2.Launcher }
> 05-24 16:35:08.734    58    90 I ActivityManager: Starting activity:
> Intent { act=android.intent.action.MAIN
> cat=[android.intent.category.LAUNCHER] flg=0x10100000
> cmp=com.example.android.recents/.ActivityB }
> 05-24 16:35:09.055    58    62 I ActivityManager: Starting activity:
> Intent { cmp=com.example.android.recents/.ActivityC }
> 05-24 16:35:09.064    58   116 W ActivityManager: Duplicate finish
> request for HistoryRecord{450a6ed8
> com.example.android.recents/.ActivityB}
> 05-24 16:35:32.916    58    90 I ActivityManager: Starting activity:
> Intent { flg=0x10100000
> cmp=com.example.android.recents/.ActivityC }    <<<<???? why is this
> successfull ?
> 05-24 16:35:33.774    58    88 I ActivityManager: Displayed activity
> com.example.android.recents/.ActivityC: 828 ms (total 24876 ms)

-- 
You received this message because you are subscribed to the Google Groups 
"Android Discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/android-discuss?hl=en.

Reply via email to