1 /*
2  * Copyright (C) 2018 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.telephony.satellite.cts;
18 
19 import android.app.Activity;
20 import android.content.Context;
21 import android.content.Intent;
22 import android.os.Bundle;
23 import android.util.Log;
24 
25 import androidx.test.InstrumentationRegistry;
26 
27 /**
28  * A mock pointing UI activity, which will be started by
29  * {@link com.android.internal.telephony.satellite.PointingAppController#startPointingUI(boolean)}.
30  */
31 public class MockPointingUiActivity extends Activity {
32     /** An intent of this action will be broadcasted when MockPointingUiActivity is launched. */
33     public static final String ACTION_MOCK_POINTING_UI_ACTIVITY_STARTED =
34             "android.telephony.satellite.cts.MOCK_POINTING_UI_ACTIVITY_STARTED";
35 
36     private static final String TAG = "MockPointingUiActivity";
37 
38     @Override
onCreate(Bundle savedInstanceState)39     protected void onCreate(Bundle savedInstanceState) {
40         Log.d(TAG, "onCreate");
41         super.onCreate(savedInstanceState);
42         Intent intent = new Intent();
43         intent.setAction(ACTION_MOCK_POINTING_UI_ACTIVITY_STARTED);
44         getContext().sendBroadcast(intent);
45         finish();
46     }
47 
getContext()48     private static Context getContext() {
49         return InstrumentationRegistry.getContext();
50     }
51 }
52