Home | History | Annotate | Download | only in testtype
      1 /*
      2  * Copyright (C) 2012 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.tradefed.testtype;
     18 
     19 import com.android.cts.tradefed.targetprep.SettingsToggler;
     20 import com.android.tradefed.device.DeviceNotAvailableException;
     21 import com.android.tradefed.result.ITestInvocationListener;
     22 
     23 /**
     24  * Running the display tests requires modification of secure settings to create an overlay display.
     25  * Secure settings cannot be changed from device CTS tests since system signature permission is
     26  * required. Such settings can be modified by the shell user, so a host side test is used.
     27  */
     28 public class DisplayTestRunner extends CtsInstrumentationApkTest {
     29     private static final String OVERLAY_DISPLAY_DEVICES_SETTING_NAME = "overlay_display_devices";
     30 
     31     // Use a non-standard pattern, must match values in tests/tests/display/.../DisplayTest.java
     32     private static final String OVERLAY_DISPLAY_DEVICES_SETTING_VALUE = "1281x721/214";
     33 
     34     @Override
     35     public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
     36         // CLog.e("run: About to enable overlay display.");
     37         SettingsToggler.setGlobalString(getDevice(), OVERLAY_DISPLAY_DEVICES_SETTING_NAME,
     38                 OVERLAY_DISPLAY_DEVICES_SETTING_VALUE);
     39 
     40         super.run(listener);
     41 
     42         // Tear down overlay display.
     43         // CLog.e("run: About to disable overlay display.");
     44         SettingsToggler.setGlobalString(getDevice(), OVERLAY_DISPLAY_DEVICES_SETTING_NAME,
     45                 "");
     46     }
     47 }
     48