Home | History | Annotate | Download | only in am
      1 /*
      2  * Copyright (C) 2017 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.am;
     18 
     19 import static android.server.am.Components.LaunchAssistantActivityIntoAssistantStack
     20         .EXTRA_ASSISTANT_IS_TRANSLUCENT;
     21 
     22 import android.app.Activity;
     23 import android.content.Intent;
     24 
     25 public class LaunchAssistantActivityIntoAssistantStack extends Activity {
     26 
     27     @Override
     28     protected void onResume() {
     29         super.onResume();
     30 
     31         final Intent intent = getIntent();
     32         if (isTranslucent(intent)) {
     33             TranslucentAssistantActivity.launchActivityIntoAssistantStack(this, intent.getExtras());
     34         } else {
     35             AssistantActivity.launchActivityIntoAssistantStack(this, getIntent().getExtras());
     36         }
     37         finishAndRemoveTask();
     38     }
     39 
     40     private static boolean isTranslucent(Intent intent) {
     41         return intent.hasExtra(EXTRA_ASSISTANT_IS_TRANSLUCENT)
     42                 && Boolean.valueOf(intent.getStringExtra(EXTRA_ASSISTANT_IS_TRANSLUCENT));
     43     }
     44 }
     45