1 /* 2 * Copyright (C) 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.server.wm.overlay; 18 19 import android.content.ComponentName; 20 import android.os.Bundle; 21 import android.server.wm.component.ComponentsBase; 22 23 24 public class Components extends ComponentsBase { 25 public interface UntrustedTouchTestService { 26 ComponentName COMPONENT = component("UntrustedTouchTestService"); 27 } 28 29 public interface OverlayActivity { 30 ComponentName COMPONENT = component("OverlayActivity"); 31 String EXTRA_OPACITY = "opacity"; 32 String EXTRA_TOUCHABLE = "touchable"; 33 String EXTRA_TOKEN_RECEIVER = "token_receiver"; 34 String EXTRA_TOKEN = "token"; 35 } 36 37 public interface ExitAnimationActivity { 38 ComponentName COMPONENT = component("ExitAnimationActivity"); 39 } 40 41 public interface ExitAnimationActivityReceiver { 42 String ACTION_FINISH = 43 "android.server.wm.overlay.ExitAnimationActivityReceiver.ACTION_FINISH"; 44 String EXTRA_ANIMATION = "animation"; 45 int EXTRA_VALUE_ANIMATION_EMPTY = 0; 46 int EXTRA_VALUE_ANIMATION_0_7 = 1; 47 int EXTRA_VALUE_ANIMATION_0_9 = 2; 48 int EXTRA_VALUE_LONG_ANIMATION_0_7 = 3; 49 } 50 51 public interface ToastActivity { 52 ComponentName COMPONENT = component("ToastActivity"); 53 } 54 55 public interface TranslucentFloatingActivity { 56 String ACTION_FINISH = 57 "android.server.wm.overlay.TranslucentFloatingActivity.ACTION_FINISH"; 58 String EXTRA_FADE_EXIT = 59 "android.server.wm.overlay.TranslucentFloatingActivity.ACTION_FINISH_FADE_EXIT"; 60 ComponentName BASE_COMPONENT = component("TranslucentFloatingActivity"); getComponent(String packageName)61 static ComponentName getComponent(String packageName) { 62 return new ComponentName(packageName, BASE_COMPONENT.getClassName()); 63 } 64 } 65 66 public interface TrampolineActivity { 67 ComponentName BASE_COMPONENT = component("TrampolineActivity"); 68 String COMPONENTS_EXTRA = "components_extra"; 69 getComponent(String packageName)70 static ComponentName getComponent(String packageName) { 71 return new ComponentName(packageName, BASE_COMPONENT.getClassName()); 72 } 73 buildTrampolineExtra(ComponentName... componentNames)74 static Bundle buildTrampolineExtra(ComponentName... componentNames) { 75 Bundle trampolineTarget = new Bundle(); 76 trampolineTarget.putParcelableArray(COMPONENTS_EXTRA, componentNames); 77 return trampolineTarget; 78 } 79 80 } 81 component(String className)82 private static ComponentName component(String className) { 83 return component(Components.class, className); 84 } 85 } 86