Android

Intent flags part02

2019-04-08  本文已影响0人  JaedenKil

May refer to part 01 and android intent.
Say I already have an intent to start Netflix playback:

am start -W -a android.intent.action.VIEW
 -d http://www.netflix.com/watch/80049212
 -e source 30 -f 0x10808000
 com.netflix.ninja/.MainActivity

So what exactly does the flag 0x10808000 contains?

    public static void main(String[] args) {
        int flags = 0x10808000; // Original flag set
        int newTask = 0x10000000; // FLAG_ACTIVITY_NEW_TASK = 0x10000000
        int flag01 = flags & ( ~ newTask);
        System.out.println(Integer.toHexString(flag01));
        int clearTask = 0x00008000; // FLAG_ACTIVITY_CLEAR_TASK = 0x00008000
        int flag02 = flag01 & ( ~ clearTask);
        System.out.println(Integer.toHexString(flag02));
        // FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS = 0x00800000
        int excludeRecent = 0x00800000;
        int flag03 = flag02 & ( ~ excludeRecent);
        System.out.println(Integer.toHexString(flag03));
    }
808000
800000
0

So the flag should be
Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS.
Have a check:

    @Test
    public void testFlag02() {
        int flag = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
        Log.d(TAG, "Flag: 0x" + Integer.toHexString(flag));
    }
Flag: 0x10808000
上一篇 下一篇

猜你喜欢

热点阅读