1 /*
2  * Copyright (C) 2024 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 com.android.cts.verifier.sharesheet;
18 
19 import static android.service.chooser.ChooserResult.CHOOSER_RESULT_COPY;
20 
21 import android.content.Intent;
22 import android.os.Bundle;
23 import android.service.chooser.ChooserResult;
24 
25 import com.android.cts.verifier.R;
26 
27 public final class SharesheetChooserResultCopyActivity extends SharesheetChooserResultActivity {
28     @Override
getTestActivityIntent()29     protected Intent getTestActivityIntent() {
30         return new Intent(this, SharesheetChooserResultCopyActivity.class)
31                 .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
32     }
33 
34     @Override
createChooserIntent()35     protected Intent createChooserIntent() {
36         Intent sendIntent = new Intent();
37         sendIntent.setAction(Intent.ACTION_SEND);
38         sendIntent.putExtra(Intent.EXTRA_TEXT,
39                 getString(R.string.sharesheet_result_test_copy_instructions_short));
40         sendIntent.setType("text/plain");
41         return wrapWithChooserIntent(sendIntent);
42     }
43 
44     @Override
onCreate(Bundle savedInstanceState)45     protected void onCreate(Bundle savedInstanceState) {
46         super.onCreate(savedInstanceState);
47 
48         setInfoResources(
49                 R.string.sharesheet_result_test_copy,
50                 R.string.sharesheet_result_test_copy_info,
51                 -1);
52 
53         setInstructions(R.string.sharesheet_result_test_copy_instructions);
54 
55         setAfterShareButtonLabels(
56                 R.string.sharesheet_result_test_copy_pressed,
57                 R.string.sharesheet_result_test_copy_not_found);
58 
59         setExpectedResult(new ChooserResult(CHOOSER_RESULT_COPY, null, false));
60     }
61 }
62