• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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.wallpaper.picker;
17 
18 import static com.android.wallpaper.util.ActivityUtils.startActivityForResultSafely;
19 
20 import android.content.Intent;
21 import android.os.Bundle;
22 
23 import androidx.annotation.Nullable;
24 import androidx.fragment.app.FragmentActivity;
25 
26 import com.android.wallpaper.module.LargeScreenMultiPanesChecker;
27 import com.android.wallpaper.module.MultiPanesChecker;
28 
29 /**
30  *  Activity to relinquish task identity for multi-pane and
31  *  prevent launching incorrect base intent in non multi-pane.
32  */
33 public class TrampolinePickerActivity extends FragmentActivity {
34 
35     private static final String TAG = "TrampolinePickerActivity";
36 
37     @Override
onCreate(@ullable Bundle savedInstanceState)38     protected void onCreate(@Nullable Bundle savedInstanceState) {
39         super.onCreate(savedInstanceState);
40         trampolineForFormFactors();
41     }
42 
trampolineForFormFactors()43     private void trampolineForFormFactors() {
44         final MultiPanesChecker multiPanesChecker = new LargeScreenMultiPanesChecker();
45         Bundle bundle = getIntent().getExtras();
46         bundle = (bundle == null) ? new Bundle() : bundle;
47         if (multiPanesChecker.isMultiPanesEnabled(this)) {
48             startActivityForResultSafely(this,
49                     new Intent(this, CustomizationPickerActivity.class).putExtras(
50                             bundle), /* requestCode= */ 0);
51         } else {
52             startActivityForResultSafely(this,
53                     new Intent(this, PassThroughCustomizationPickerActivity.class).putExtras(
54                             bundle), /* requestCode= */ 0);
55         }
56         finish();
57     }
58 }
59 
60