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 17 package com.android.cts.verifier.controls; 18 19 import android.app.ActivityTaskManager; 20 import android.database.DataSetObserver; 21 import android.os.Bundle; 22 import android.widget.TextView; 23 24 import com.android.cts.verifier.ArrayTestListAdapter; 25 import com.android.cts.verifier.ManifestTestListAdapter; 26 import com.android.cts.verifier.PassFailButtons; 27 import com.android.cts.verifier.R; 28 29 public class ControlsPanelVerifierTestList extends PassFailButtons.TestListActivity { 30 @Override onCreate(Bundle savedInstanceState)31 protected void onCreate(Bundle savedInstanceState) { 32 super.onCreate(savedInstanceState); 33 34 setContentView(R.layout.pass_fail_list); 35 setPassFailButtonClickListeners(); 36 37 if (ActivityTaskManager.supportsMultiWindow(this)) { 38 39 getPassButton().setEnabled(false); 40 41 ManifestTestListAdapter adapter = new ManifestTestListAdapter(this, 42 getClass().getName()); 43 setTestListAdapter(adapter); 44 45 adapter.registerDataSetObserver(new DataSetObserver() { 46 @Override 47 public void onChanged() { 48 updatePassButton(); 49 } 50 51 @Override 52 public void onInvalidated() { 53 updatePassButton(); 54 } 55 }); 56 } else { 57 TextView text = findViewById(android.R.id.empty); 58 text.setText(R.string.controls_panel_not_supported); 59 setTestListAdapter(new ArrayTestListAdapter(this)); 60 updatePassButton(); 61 } 62 } 63 64 } 65