Altering the result of getRecentTasks

前端 未结 2 567
温柔的废话
温柔的废话 2020-12-03 09:06

I have an app designed for a tablet in a workplace setting where a number of people will use the camera as part of their routine. While it\'s appropriate and necessary for

相关标签:
2条回答
  • 2020-12-03 09:58

    Credit goes to the author of Toddler Lock, with whom I spoke about the issue. Errors introduced are entirely mine.

    Create within your manifest a disabled activity with affinity equal to the empty string. In your program, enable it and then start it up using an intent flagged FLAG_ACTIVITY_NEW_TASK. It will show up in the recent activities. Disable the task and it disappears from the display.

    Make enough of these and you flood the recent activities display. If it has a way to go back more activities than you have dummy activities the user will be able to get out of your program.

    Make sure you disable the tasks when you exit, and make sure that if you select one of those tasks from recent activities your program does something reasonable.

    Here's an example of two of the tasks in my manifest:

        <activity android:name="com.foo.android.recentactivity.Clear1"
                  android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
                  android:label="."
                  android:enabled="false"
                  android:icon="@drawable/clearicon"
                  android:taskAffinity="" />
        <activity android:name="com.foo.android.recentactivity.Clear2"
                  android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
                  android:label="."
                  android:enabled="false"
                  android:icon="@drawable/clearicon"
                  android:taskAffinity="" />
    
    0 讨论(0)
  • 2020-12-03 10:07

    You can't do this from an application. You would need to build a custom system image with the behavior you want.

    0 讨论(0)
提交回复
热议问题