blob: fabcf3d920a94d508d582a502e019f165e1627d6 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2008 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
Neal Nguyen1d3165f2010-01-12 13:26:10 -080017package android.os;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080018
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080019import android.app.Activity;
Michael Wrightd8460232018-01-16 18:04:59 +000020import android.hardware.display.DisplayManager;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080021import android.os.Bundle;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.provider.Settings;
23import android.view.View;
24import android.view.View.OnClickListener;
25import android.widget.Button;
26
Neal Nguyen1d3165f2010-01-12 13:26:10 -080027import com.android.frameworks.coretests.R;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028
29/**
30 * Tries to set the brightness to 0. Should be silently thwarted by the framework.
31 */
32public class BrightnessLimit extends Activity implements OnClickListener {
33
34 @Override
35 protected void onCreate(Bundle savedInstanceState) {
36 super.onCreate(savedInstanceState);
Michael Wrightd8460232018-01-16 18:04:59 +000037
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038 setContentView(R.layout.brightness_limit);
Michael Wrightd8460232018-01-16 18:04:59 +000039
Alan Viverette51efddb2017-04-05 10:00:01 -040040 Button b = findViewById(R.id.go);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041 b.setOnClickListener(this);
42 }
43
44 public void onClick(View v) {
Michael Wrightd8460232018-01-16 18:04:59 +000045 DisplayManager dm = getSystemService(DisplayManager.class);
46 dm.setTemporaryBrightness(0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047 Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, 0);
48 }
49}
50