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.packageinstaller.permission.ui.auto; 18 19 import android.app.Activity; 20 import android.view.WindowManager; 21 22 import com.android.packageinstaller.permission.ui.handheld.GrantPermissionsViewHandlerImpl; 23 24 /** 25 * A {@link com.android.packageinstaller.permission.ui.GrantPermissionsViewHandler} that is 26 * specific for the auto use-case. In this case, the permissions dialog needs to be larger to make 27 * clicking and reading safer in the car. Otherwise, the UI remains the same. 28 * 29 * <p>The reason this class extends {@link GrantPermissionsViewHandlerImpl} is so that it can 30 * change the window params to allow the dialog's width to be larger. 31 */ 32 public class GrantPermissionsAutoViewHandler extends GrantPermissionsViewHandlerImpl { 33 public GrantPermissionsAutoViewHandler(Activity activity, String appPackageName) { 34 super(activity, appPackageName); 35 } 36 37 /** 38 * Update the given {@link android.view.WindowManager.LayoutParams} to allow the dialog to take 39 * up the entirety of the width. 40 */ 41 @Override 42 public void updateWindowAttributes(WindowManager.LayoutParams outLayoutParams) { 43 outLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; 44 outLayoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT; 45 } 46 } 47