1 /* 2 * Copyright (C) 2016 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.content.Intent; 20 import android.os.Bundle; 21 import android.widget.TextView; 22 23 import com.android.cts.verifier.PassFailButtons; 24 import com.android.cts.verifier.R; 25 26 /** 27 * A test Activity that has an info text and pass/fail buttons, nothing else. 28 */ 29 public class EnterprisePrivacyInfoOnlyTestActivity extends PassFailButtons.Activity { 30 public static final String EXTRA_ID = "id"; 31 public static final String EXTRA_TITLE = "title"; 32 public static final String EXTRA_INFO = "info"; 33 34 private String mTestId; 35 36 @Override onCreate(Bundle savedInstanceState)37 protected void onCreate(Bundle savedInstanceState) { 38 super.onCreate(savedInstanceState); 39 setContentView(R.layout.enterprise_privacy_negative_test); 40 setPassFailButtonClickListeners(); 41 42 final Intent intent = getIntent(); 43 if (!intent.hasExtra(EXTRA_ID) 44 || !intent.hasExtra(EXTRA_TITLE) 45 || !intent.hasExtra(EXTRA_INFO)) { 46 throw new IllegalArgumentException( 47 "Intent must have EXTRA_ID, EXTRA_TITLE & EXTRA_INFO"); 48 } 49 50 mTestId = intent.getStringExtra(EXTRA_ID); 51 setTitle(intent.getIntExtra(EXTRA_TITLE, -1)); 52 53 final TextView info = (TextView) findViewById(R.id.info); 54 info.setText(intent.getIntExtra(EXTRA_INFO, -1)); 55 } 56 57 @Override onResume()58 protected void onResume() { 59 super.onResume(); 60 setResult(RESULT_CANCELED); 61 } 62 63 @Override getTestId()64 public String getTestId() { 65 return mTestId; 66 } 67 } 68