• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2015 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 package com.android.messaging.ui;
17 
18 import android.content.Intent;
19 import android.os.Bundle;
20 import android.telephony.TelephonyManager;
21 
22 import com.android.messaging.datamodel.NoConfirmationSmsSendService;
23 import com.android.messaging.util.LogUtil;
24 
25 public class RemoteInputEntrypointActivity extends BaseBugleActivity {
26     private static final String TAG = LogUtil.BUGLE_TAG;
27 
28     @Override
onCreate(Bundle savedInstanceState)29     protected void onCreate(Bundle savedInstanceState) {
30         super.onCreate(savedInstanceState);
31 
32         Intent intent = getIntent();
33         if (intent == null) {
34             LogUtil.w(TAG, "No intent attached");
35             setResult(RESULT_CANCELED);
36             finish();
37             return;
38         }
39 
40         // Perform some action depending on the intent
41         String action = intent.getAction();
42         if (Intent.ACTION_SENDTO.equals(action)) {
43             // Build and send the intent
44             final Intent sendIntent = new Intent(this, NoConfirmationSmsSendService.class);
45             sendIntent.setAction(TelephonyManager.ACTION_RESPOND_VIA_MESSAGE);
46             sendIntent.putExtras(intent);
47             // Wear apparently passes all of its extras via the clip data. Must pass it along.
48             sendIntent.setClipData(intent.getClipData());
49             startService(sendIntent);
50             setResult(RESULT_OK);
51         } else {
52             LogUtil.w(TAG, "Unrecognized intent action: " + action);
53             setResult(RESULT_CANCELED);
54         }
55         // This activity should never stick around after processing the intent
56         finish();
57     }
58 }
59