diff options
author | Jorim Jaggi <jjaggi@google.com> | 2017-02-22 16:45:48 +0100 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2017-03-22 15:59:44 +0100 |
commit | 0fe7ce968bc7f0eff64f08e2d51c8b1e6b4a6fc8 (patch) | |
tree | c7032c5de42a5b3fd23f7be2fadbceb9643f3684 /tests/ActivityTests/src | |
parent | 6f9dbcb742ee930151444118dd61c2239efce09d (diff) |
Add API to disable snapshotting of activities
Test: runtest frameworks-services -c
com.android.server.wm.TaskSnapshotControllerTest
Test: Launch DisableScreenshotsActivity, go to recents, make sure
content is white.
Bug: 31339431
Change-Id: I329925d2fca389e561da3389a67fe888b5bb1033
Diffstat (limited to 'tests/ActivityTests/src')
-rw-r--r-- | tests/ActivityTests/src/com/google/android/test/activity/DisableScreenshotsActivity.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/ActivityTests/src/com/google/android/test/activity/DisableScreenshotsActivity.java b/tests/ActivityTests/src/com/google/android/test/activity/DisableScreenshotsActivity.java new file mode 100644 index 000000000000..de24ca2ac9e8 --- /dev/null +++ b/tests/ActivityTests/src/com/google/android/test/activity/DisableScreenshotsActivity.java @@ -0,0 +1,35 @@ +/* + * 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 + */ + +package com.google.android.test.activity; + +import android.annotation.Nullable; +import android.app.Activity; +import android.graphics.Color; +import android.os.Bundle; + +/** + * Activity for which screenshotting is disabled. + */ +public class DisableScreenshotsActivity extends Activity { + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setDisablePreviewScreenshots(true); + getWindow().getDecorView().setBackgroundColor(Color.RED); + } +} |