1 /* 2 * Copyright (C) 2018 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.managedprovisioning; 18 19 import android.app.Activity; 20 import android.content.Intent; 21 import android.os.Bundle; 22 23 /** 24 * Handles com.android.cts.verifier.managedprovisioning.RECENTS intent sent 25 * from main profile to work profile. 26 * 27 * {@link RecentsRedactionActivity} is required to stay in Recents to complete 28 * "Recent Redaction Test". However a {@link Intent#FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS} will be 29 * added by framework when intent {@link RecentsRedactionActivity#ACTION_RECENTS} is sent from 30 * personal profile to work profile. By adding this {@link IntermediateRecentActivity} and 31 * let it hanlde {@link RecentsRedactionActivity#ACTION_RECENTS} and then start 32 * {@link IntermediateRecentActivity} in a new task, we can make sure no 33 * {@link Intent#FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS} is added for starting 34 * {@link IntermediateRecentActivity}. 35 */ 36 public class IntermediateRecentActivity extends Activity { 37 38 @Override onCreate(Bundle savedInstanceState)39 protected void onCreate(Bundle savedInstanceState) { 40 super.onCreate(savedInstanceState); 41 startActivity(new Intent(this, RecentsRedactionActivity.class).addFlags( 42 Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK)); 43 finish(); 44 } 45 } 46