美文网首页Android
Intent flags part02

Intent flags part02

作者: JaedenKil | 来源:发表于2019-04-08 15:55 被阅读0次

    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
    

    相关文章

      网友评论

        本文标题:Intent flags part02

        本文链接:https://www.haomeiwen.com/subject/lktpiqtx.html