59b9885bc8
Added two new flags to the Activity to turn the screen on and show on the lock screen. These can be used instead of the Window flags LayouParams.FLAG_TURN_SCREEN_ON and LayoutParams.FLAG_SHOW_WHEN_LOCKED to prevent the double onStart/onResume lifecycle events. The flags can be set as an attr for the Activity in the AndroidManifest using android:showWhenLocked="true" and android:turnScreenOn="true". They can also be set through methods in the Activity class using setShowWhenLocked(true) and setTurnScreen(true). Fixes: 36850100 Test: Created sample application, tests/ShowWhenLockedApp, that set the flags in the manifest and code. Tested multiple scenarios to launch the Activity with the flags set and unset. Test: cts-tradefed run commandAndExit cts-dev --module CtsServicesHostTestCases -t android.server.cts.KeyguardTransitionTests Test: cts-tradefed run commandAndExit cts-dev --module CtsServicesHostTestCases -t android.server.cts.ActivityManagerActivityVisibilityTests Test: cts-tradefed run commandAndExit cts-dev --module CtsServicesHostTestCases -t android.server.cts.KeyguardTests Change-Id: I44f0e313df4531d49c7ac56108b6bf80e41fefc1
32 lines
1.2 KiB
XML
32 lines
1.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!--
|
|
* Copyright (C) 2017 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License
|
|
-->
|
|
|
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
package="com.android.showwhenlocked">
|
|
<application android:label="ShowWhenLocked">
|
|
<activity android:name=".ShowWhenLockedActivity"
|
|
android:showWhenLocked="true"
|
|
android:turnScreenOn="true"
|
|
android:launchMode="singleTask">
|
|
<intent-filter>
|
|
<action android:name="android.intent.action.MAIN"/>
|
|
<category android:name="android.intent.category.LAUNCHER"/>
|
|
</intent-filter>
|
|
</activity>
|
|
</application>
|
|
</manifest>
|