HeadlessDisplayAdapter.java revision 908aecc3a63c5520d5b11da14a9383f885b7d126
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 17package com.android.server.display; 18 19import android.util.DisplayMetrics; 20 21/** 22 * Provides a fake default display for headless systems. 23 */ 24public final class HeadlessDisplayAdapter extends DisplayAdapter { 25 private final DisplayDevice mDefaultDisplay = new DisplayDevice() { 26 @Override 27 public void getInfo(DisplayDeviceInfo outInfo) { 28 outInfo.width = 640; 29 outInfo.height = 480; 30 outInfo.refreshRate = 60; 31 outInfo.densityDpi = DisplayMetrics.DENSITY_DEFAULT; 32 outInfo.xDpi = 160; 33 outInfo.yDpi = 160; 34 } 35 }; 36 37 @Override 38 public String getName() { 39 return "HeadlessDisplayAdapter"; 40 } 41 42 @Override 43 public DisplayDevice[] getDisplayDevices() { 44 return new DisplayDevice[] { mDefaultDisplay }; 45 } 46} 47