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 /** 27 * Activity to retain correct base intent in non multi-pane case. 28 */ 29 public class PassThroughCustomizationPickerActivity extends FragmentActivity { 30 31 private static final String TAG = "PassThroughCustomizationPickerActivity"; 32 33 @Override onCreate(@ullable Bundle savedInstanceState)34 protected void onCreate(@Nullable Bundle savedInstanceState) { 35 super.onCreate(savedInstanceState); 36 retainBaseIntent(); 37 } 38 retainBaseIntent()39 private void retainBaseIntent() { 40 Bundle bundle = getIntent().getExtras(); 41 bundle = (bundle == null) ? new Bundle() : bundle; 42 // Trampoline for the phone without relinquishTaskIdentity case 43 startActivityForResultSafely(this, 44 new Intent(this, CustomizationPickerActivity.class).putExtras( 45 bundle), /* requestCode= */ 0); 46 finish(); 47 } 48 } 49 50