AlertController cleanup

Remove APIs from this isolated AlertController which are not used in
Package Installer app. Also, remove unused resources and classes.

Bug: 241139604
Test: Manual UI testing
Change-Id: I9428c761ff53aea21323fa420d42a5ab624b8bb2
diff --git a/packages/PackageInstaller/res/layout/alert_dialog.xml b/packages/PackageInstaller/res/layout/alert_dialog.xml
deleted file mode 100644
index 16b6d39..0000000
--- a/packages/PackageInstaller/res/layout/alert_dialog.xml
+++ /dev/null
@@ -1,152 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* //device/apps/common/res/layout/alert_dialog.xml
-**
-** Copyright 2006, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/parentPanel"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:orientation="vertical"
-    android:paddingTop="9dip"
-    android:paddingBottom="3dip"
-    android:paddingStart="3dip"
-    android:paddingEnd="1dip">
-
-    <LinearLayout android:id="@+id/topPanel"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:minHeight="54dip"
-        android:orientation="vertical">
-        <LinearLayout android:id="@+id/title_template"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal"
-            android:gravity="center_vertical"
-            android:layout_marginTop="6dip"
-            android:layout_marginBottom="9dip"
-            android:layout_marginStart="10dip"
-            android:layout_marginEnd="10dip">
-            <ImageView android:id="@+id/icon"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="top"
-                android:paddingTop="6dip"
-                android:paddingEnd="10dip"
-                android:src="@drawable/ic_dialog_info" />
-            <com.android.packageinstaller.DialogTitle android:id="@+id/alertTitle"
-                style="?android:attr/textAppearanceLarge"
-                android:singleLine="true"
-                android:ellipsize="end"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textAlignment="viewStart" />
-        </LinearLayout>
-        <ImageView android:id="@+id/titleDivider"
-            android:layout_width="match_parent"
-            android:layout_height="1dip"
-            android:visibility="gone"
-            android:scaleType="fitXY"
-            android:gravity="fill_horizontal"
-            android:src="@android:drawable/divider_horizontal_dark" />
-        <!-- If the client uses a customTitle, it will be added here. -->
-    </LinearLayout>
-
-    <LinearLayout android:id="@+id/contentPanel"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1"
-        android:orientation="vertical">
-        <ScrollView android:id="@+id/scrollView"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:paddingTop="2dip"
-            android:paddingBottom="12dip"
-            android:paddingStart="14dip"
-            android:paddingEnd="10dip"
-            android:overScrollMode="ifContentScrolls">
-            <TextView android:id="@+id/message"
-                style="?android:attr/textAppearanceMedium"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:padding="5dip" />
-        </ScrollView>
-    </LinearLayout>
-
-    <FrameLayout android:id="@+id/customPanel"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1">
-        <FrameLayout android:id="@+id/custom"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:paddingTop="5dip"
-            android:paddingBottom="5dip" />
-    </FrameLayout>
-
-    <LinearLayout android:id="@+id/buttonPanel"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:minHeight="54dip"
-        android:orientation="vertical" >
-        <LinearLayout
-            style="?android:attr/buttonBarStyle"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal"
-            android:paddingTop="4dip"
-            android:paddingStart="2dip"
-            android:paddingEnd="2dip"
-            android:measureWithLargestChild="true">
-            <LinearLayout android:id="@+id/leftSpacer"
-                android:layout_weight="0.25"
-                android:layout_width="0dip"
-                android:layout_height="wrap_content"
-                android:orientation="horizontal"
-                android:visibility="gone" />
-            <Button android:id="@+id/button1"
-                android:layout_width="0dip"
-                android:layout_gravity="start"
-                android:layout_weight="1"
-                style="?android:attr/buttonBarPositiveButtonStyle"
-                android:maxLines="2"
-                android:layout_height="wrap_content" />
-            <Button android:id="@+id/button3"
-                android:layout_width="0dip"
-                android:layout_gravity="center_horizontal"
-                android:layout_weight="1"
-                style="?android:attr/buttonBarNeutralButtonStyle"
-                android:maxLines="2"
-                android:layout_height="wrap_content" />
-            <Button android:id="@+id/button2"
-                android:layout_width="0dip"
-                android:layout_gravity="end"
-                android:layout_weight="1"
-                style="?android:attr/buttonBarNegativeButtonStyle"
-                android:maxLines="2"
-                android:layout_height="wrap_content" />
-            <LinearLayout android:id="@+id/rightSpacer"
-                android:layout_width="0dip"
-                android:layout_weight="0.25"
-                android:layout_height="wrap_content"
-                android:orientation="horizontal"
-                android:visibility="gone" />
-        </LinearLayout>
-     </LinearLayout>
-</LinearLayout>
diff --git a/packages/PackageInstaller/res/layout/alert_dialog_holo.xml b/packages/PackageInstaller/res/layout/alert_dialog_holo.xml
deleted file mode 100644
index b5b3927..0000000
--- a/packages/PackageInstaller/res/layout/alert_dialog_holo.xml
+++ /dev/null
@@ -1,142 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2010, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/parentPanel"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:layout_marginStart="8dip"
-    android:layout_marginEnd="8dip"
-    android:orientation="vertical">
-
-    <LinearLayout android:id="@+id/topPanel"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="vertical">
-        <View android:id="@+id/titleDividerTop"
-            android:layout_width="match_parent"
-            android:layout_height="2dip"
-            android:visibility="gone"
-            android:background="@android:color/holo_blue_light" />
-        <LinearLayout android:id="@+id/title_template"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal"
-            android:gravity="center_vertical|start"
-            android:minHeight="@dimen/alert_dialog_title_height"
-            android:layout_marginStart="16dip"
-            android:layout_marginEnd="16dip">
-            <ImageView android:id="@+id/icon"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:paddingEnd="8dip"
-                android:src="@null" />
-            <com.android.packageinstaller.DialogTitle android:id="@+id/alertTitle"
-                style="?android:attr/windowTitleStyle"
-                android:singleLine="true"
-                android:ellipsize="end"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textAlignment="viewStart" />
-        </LinearLayout>
-        <View android:id="@+id/titleDivider"
-            android:layout_width="match_parent"
-            android:layout_height="2dip"
-            android:visibility="gone"
-            android:background="@android:color/holo_blue_light" />
-        <!-- If the client uses a customTitle, it will be added here. -->
-    </LinearLayout>
-
-    <LinearLayout android:id="@+id/contentPanel"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1"
-        android:orientation="vertical"
-        android:minHeight="64dp">
-        <ScrollView android:id="@+id/scrollView"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:clipToPadding="false">
-            <TextView android:id="@+id/message"
-                style="?android:attr/textAppearanceMedium"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:paddingStart="16dip"
-                android:paddingEnd="16dip"
-                android:paddingTop="8dip"
-                android:paddingBottom="8dip"/>
-        </ScrollView>
-    </LinearLayout>
-
-    <FrameLayout android:id="@+id/customPanel"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1"
-        android:minHeight="64dp">
-        <FrameLayout android:id="@+id/custom"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
-    </FrameLayout>
-
-    <LinearLayout android:id="@+id/buttonPanel"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:minHeight="@dimen/alert_dialog_button_bar_height"
-        android:orientation="vertical"
-        android:divider="?android:attr/dividerHorizontal"
-        android:showDividers="beginning"
-        android:dividerPadding="0dip">
-        <LinearLayout
-            style="?android:attr/buttonBarStyle"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal"
-            android:layoutDirection="locale"
-            android:measureWithLargestChild="true">
-            <Button android:id="@+id/button2"
-                android:layout_width="wrap_content"
-                android:layout_gravity="start"
-                android:layout_weight="1"
-                android:maxLines="2"
-                style="?android:attr/buttonBarButtonStyle"
-                android:textSize="14sp"
-                android:minHeight="@dimen/alert_dialog_button_bar_height"
-                android:layout_height="wrap_content" />
-            <Button android:id="@+id/button3"
-                android:layout_width="wrap_content"
-                android:layout_gravity="center_horizontal"
-                android:layout_weight="1"
-                android:maxLines="2"
-                style="?android:attr/buttonBarButtonStyle"
-                android:textSize="14sp"
-                android:minHeight="@dimen/alert_dialog_button_bar_height"
-                android:layout_height="wrap_content" />
-            <Button android:id="@+id/button1"
-                android:layout_width="wrap_content"
-                android:layout_gravity="end"
-                android:layout_weight="1"
-                android:maxLines="2"
-                android:minHeight="@dimen/alert_dialog_button_bar_height"
-                style="?android:attr/buttonBarButtonStyle"
-                android:textSize="14sp"
-                android:layout_height="wrap_content" />
-        </LinearLayout>
-     </LinearLayout>
-</LinearLayout>
diff --git a/packages/PackageInstaller/res/layout/select_dialog.xml b/packages/PackageInstaller/res/layout/select_dialog.xml
deleted file mode 100644
index e2d0739..0000000
--- a/packages/PackageInstaller/res/layout/select_dialog.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* //device/apps/common/res/layout/select_dialog.xml
-**
-** Copyright 2006, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<!--
-    This layout file is used by the AlertDialog when displaying a list of items.
-    This layout file is inflated and used as the ListView to display the items.
-    Assign an ID so its state will be saved/restored.
--->
-<view class="com.android.packageinstaller.AlertController$RecycleListView"
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/select_dialog_listview"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:layout_marginTop="5px"
-    android:cacheColorHint="@null"
-    android:divider="?android:attr/listDividerAlertDialog"
-    android:scrollbars="vertical"
-    android:overScrollMode="ifContentScrolls"
-    android:textAlignment="viewStart" />
diff --git a/packages/PackageInstaller/res/layout/select_dialog_item.xml b/packages/PackageInstaller/res/layout/select_dialog_item.xml
deleted file mode 100644
index 835c433..0000000
--- a/packages/PackageInstaller/res/layout/select_dialog_item.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* //device/apps/common/res/layout/select_dialog_item.xml
-**
-** Copyright 2006, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<!--
-    This layout file is used by the AlertDialog when displaying a list of items.
-    This layout file is inflated and used as the TextView to display individual
-    items.
--->
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@android:id/text1"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:minHeight="?android:attr/listPreferredItemHeight"
-    android:textAppearance="?android:attr/textAppearanceLarge"
-    android:textColor="?android:attr/textColorAlertDialogListItem"
-    android:gravity="center_vertical"
-    android:paddingStart="14dip"
-    android:paddingEnd="15dip"
-    android:ellipsize="marquee"
-/>
diff --git a/packages/PackageInstaller/res/layout/select_dialog_multichoice.xml b/packages/PackageInstaller/res/layout/select_dialog_multichoice.xml
deleted file mode 100644
index 2dd83a3..0000000
--- a/packages/PackageInstaller/res/layout/select_dialog_multichoice.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-  
-          http://www.apache.org/licenses/LICENSE-2.0
-  
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@android:id/text1"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:minHeight="?android:attr/listPreferredItemHeight"
-    android:textAppearance="?android:attr/textAppearanceLarge"
-    android:textColor="?android:attr/textColorAlertDialogListItem"
-    android:gravity="center_vertical"
-    android:paddingStart="12dip"
-    android:paddingEnd="7dip"
-    android:checkMark="?android:attr/listChoiceIndicatorMultiple"
-    android:ellipsize="marquee"
-/>
-
diff --git a/packages/PackageInstaller/res/layout/select_dialog_singlechoice.xml b/packages/PackageInstaller/res/layout/select_dialog_singlechoice.xml
deleted file mode 100644
index 1e18b44..0000000
--- a/packages/PackageInstaller/res/layout/select_dialog_singlechoice.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-  
-          http://www.apache.org/licenses/LICENSE-2.0
-  
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@android:id/text1"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:minHeight="?android:attr/listPreferredItemHeight"
-    android:textAppearance="?android:attr/textAppearanceLarge"
-    android:textColor="?android:attr/textColorAlertDialogListItem"
-    android:gravity="center_vertical"
-    android:paddingStart="12dip"
-    android:paddingEnd="7dip"
-    android:checkMark="?android:attr/listChoiceIndicatorSingle"
-    android:ellipsize="marquee"
-/>
diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/AlertActivity.java b/packages/PackageInstaller/src/com/android/packageinstaller/AlertActivity.java
index b96435b..7947400 100644
--- a/packages/PackageInstaller/src/com/android/packageinstaller/AlertActivity.java
+++ b/packages/PackageInstaller/src/com/android/packageinstaller/AlertActivity.java
@@ -18,7 +18,6 @@
 
 import android.app.Activity;
 import android.app.Dialog;
-import android.compat.annotation.UnsupportedAppUsage;
 import android.content.DialogInterface;
 import android.os.Bundle;
 import android.view.KeyEvent;
@@ -29,35 +28,24 @@
  * An activity that follows the visual style of an AlertDialog.
  * 
  * @see #mAlert
- * @see #mAlertParams
  * @see #setupAlert()
  */
 public abstract class AlertActivity extends Activity implements DialogInterface {
 
-    @UnsupportedAppUsage
     public AlertActivity() {
     }
 
     /**
      * The model for the alert.
      * 
-     * @see #mAlertParams
      */
-    @UnsupportedAppUsage
     protected AlertController mAlert;
 
-    /**
-     * The parameters for the alert.
-     */
-    @UnsupportedAppUsage
-    protected AlertController.AlertParams mAlertParams;
-
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        mAlert = AlertController.create(this, this, getWindow());
-        mAlertParams = new AlertController.AlertParams(this);
+        mAlert = new AlertController(this, this, getWindow());
     }
 
     public void cancel() {
@@ -95,11 +83,9 @@
      * and installing the alert's content.
      *
      * @see #mAlert
-     * @see #mAlertParams
      */
-    @UnsupportedAppUsage
     protected void setupAlert() {
-        mAlert.installContent(mAlertParams);
+        mAlert.installContent();
     }
 
     @Override
diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/AlertController.java b/packages/PackageInstaller/src/com/android/packageinstaller/AlertController.java
index 35d2518..33f38a6 100644
--- a/packages/PackageInstaller/src/com/android/packageinstaller/AlertController.java
+++ b/packages/PackageInstaller/src/com/android/packageinstaller/AlertController.java
@@ -18,22 +18,13 @@
 
 import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
 
-import android.app.AlertDialog;
-import android.compat.annotation.UnsupportedAppUsage;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.res.TypedArray;
-import android.database.Cursor;
 import android.graphics.drawable.Drawable;
-import android.os.Build;
 import android.os.Handler;
 import android.os.Message;
-import android.text.Layout;
 import android.text.TextUtils;
-import android.text.method.MovementMethod;
-import android.util.AttributeSet;
-import android.util.TypedValue;
-import android.view.Gravity;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -43,19 +34,12 @@
 import android.view.ViewStub;
 import android.view.Window;
 import android.view.WindowManager;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.ArrayAdapter;
 import android.widget.Button;
-import android.widget.CheckedTextView;
-import android.widget.CursorAdapter;
 import android.widget.FrameLayout;
 import android.widget.ImageView;
-import android.widget.LinearLayout;
 import android.widget.ListAdapter;
 import android.widget.ListView;
 import android.widget.ScrollView;
-import android.widget.SimpleCursorAdapter;
 import android.widget.TextView;
 
 import androidx.annotation.Nullable;
@@ -65,17 +49,13 @@
 import java.lang.ref.WeakReference;
 
 public class AlertController {
-    public static final int MICRO = 1;
-
     private final Context mContext;
     private final DialogInterface mDialogInterface;
     protected final Window mWindow;
 
-    @UnsupportedAppUsage
     private CharSequence mTitle;
     protected CharSequence mMessage;
     protected ListView mListView;
-    @UnsupportedAppUsage
     private View mView;
 
     private int mViewLayoutResId;
@@ -106,19 +86,9 @@
     private ImageView mIconView;
     private TextView mTitleView;
     protected TextView mMessageView;
-    private MovementMethod mMessageMovementMethod;
-    @Layout.HyphenationFrequency // will be removed in cleanup
-    private Integer mMessageHyphenationFrequency; // cleanup
-    @UnsupportedAppUsage
-    private View mCustomTitleView;
-
-    @UnsupportedAppUsage
-    private boolean mForceInverseBackground;
 
     private ListAdapter mAdapter;
 
-    private int mCheckedItem = -1;
-
     private int mAlertDialogLayout;
     private int mButtonPanelSideLayout;
     private int mListLayout;
@@ -128,8 +98,6 @@
 
     private boolean mShowTitle;
 
-    private int mButtonPanelLayoutHint = AlertDialog.LAYOUT_HINT_NONE;
-
     private Handler mHandler;
 
     private final View.OnClickListener mButtonHandler = new View.OnClickListener() {
@@ -182,29 +150,7 @@
         }
     }
 
-    private static boolean shouldCenterSingleButton(Context context) {
-        final TypedValue outValue = new TypedValue();
-        context.getTheme().resolveAttribute(R.attr.alertDialogCenterButtons, outValue, true);
-        return outValue.data != 0;
-    }
-
-    public static final AlertController create(Context context, DialogInterface di, Window window) {
-        final TypedArray a = context.obtainStyledAttributes(
-                null, R.styleable.AlertDialog, R.attr.alertDialogStyle,
-                android.R.style.Theme_DeviceDefault_Settings);
-        int controllerType = a.getInt(R.styleable.AlertDialog_controllerType, 0);
-        a.recycle();
-
-        switch (controllerType) {
-            case MICRO:
-                return new MicroAlertController(context, di, window);
-            default:
-                return new AlertController(context, di, window);
-        }
-    }
-
-    @UnsupportedAppUsage
-    protected AlertController(Context context, DialogInterface di, Window window) {
+    public AlertController(Context context, DialogInterface di, Window window) {
         mContext = context;
         mDialogInterface = di;
         mWindow = window;
@@ -214,21 +160,21 @@
                 R.styleable.AlertDialog, R.attr.alertDialogStyle, 0);
 
         mAlertDialogLayout = a.getResourceId(
-                R.styleable.AlertDialog_layout, R.layout.alert_dialog);
+                R.styleable.AlertDialog_layout, R.layout.alert_dialog_material);
         mButtonPanelSideLayout = a.getResourceId(
                 R.styleable.AlertDialog_buttonPanelSideLayout, 0);
         mListLayout = a.getResourceId(
-                R.styleable.AlertDialog_listLayout, R.layout.select_dialog);
+                R.styleable.AlertDialog_listLayout, R.layout.select_dialog_material);
 
         mMultiChoiceItemLayout = a.getResourceId(
                 R.styleable.AlertDialog_multiChoiceItemLayout,
-                R.layout.select_dialog_multichoice);
+                R.layout.select_dialog_multichoice_material);
         mSingleChoiceItemLayout = a.getResourceId(
                 R.styleable.AlertDialog_singleChoiceItemLayout,
-                R.layout.select_dialog_singlechoice);
+                R.layout.select_dialog_singlechoice_material);
         mListItemLayout = a.getResourceId(
                 R.styleable.AlertDialog_listItemLayout,
-                R.layout.select_dialog_item);
+                R.layout.select_dialog_item_material);
         mShowTitle = a.getBoolean(R.styleable.AlertDialog_showTitle, true);
 
         a.recycle();
@@ -259,30 +205,11 @@
         return false;
     }
 
-    public void installContent(AlertParams params) {
-        params.apply(this);
-        installContent();
-    }
-
-    @UnsupportedAppUsage
     public void installContent() {
-        int contentView = selectContentView();
-        mWindow.setContentView(contentView);
+        mWindow.setContentView(mAlertDialogLayout);
         setupView();
     }
 
-    private int selectContentView() {
-        if (mButtonPanelSideLayout == 0) {
-            return mAlertDialogLayout;
-        }
-        if (mButtonPanelLayoutHint == AlertDialog.LAYOUT_HINT_SIDE) {
-            return mButtonPanelSideLayout;
-        }
-        // TODO: use layout hint side for long messages/lists
-        return mAlertDialogLayout;
-    }
-
-    @UnsupportedAppUsage
     public void setTitle(CharSequence title) {
         mTitle = title;
         if (mTitleView != null) {
@@ -292,37 +219,6 @@
     }
 
     /**
-     * @see AlertDialog.Builder#setCustomTitle(View)
-     */
-    @UnsupportedAppUsage
-    public void setCustomTitle(View customTitleView) {
-        mCustomTitleView = customTitleView;
-    }
-
-    @UnsupportedAppUsage
-    public void setMessage(CharSequence message) {
-        mMessage = message;
-        if (mMessageView != null) {
-            mMessageView.setText(message);
-        }
-    }
-
-    public void setMessageMovementMethod(MovementMethod movementMethod) {
-        mMessageMovementMethod = movementMethod;
-        if (mMessageView != null) {
-            mMessageView.setMovementMethod(movementMethod);
-        }
-    }
-
-    public void setMessageHyphenationFrequency(
-            @Layout.HyphenationFrequency int hyphenationFrequency) {
-        mMessageHyphenationFrequency = hyphenationFrequency;
-        if (mMessageView != null) {
-            mMessageView.setHyphenationFrequency(hyphenationFrequency);
-        }
-    }
-
-    /**
      * Set the view resource to display in the dialog.
      */
     public void setView(int layoutResId) {
@@ -332,37 +228,6 @@
     }
 
     /**
-     * Set the view to display in the dialog.
-     */
-    @UnsupportedAppUsage
-    public void setView(View view) {
-        mView = view;
-        mViewLayoutResId = 0;
-        mViewSpacingSpecified = false;
-    }
-
-    /**
-     * Set the view to display in the dialog along with the spacing around that view
-     */
-    public void setView(View view, int viewSpacingLeft, int viewSpacingTop, int viewSpacingRight,
-            int viewSpacingBottom) {
-        mView = view;
-        mViewLayoutResId = 0;
-        mViewSpacingSpecified = true;
-        mViewSpacingLeft = viewSpacingLeft;
-        mViewSpacingTop = viewSpacingTop;
-        mViewSpacingRight = viewSpacingRight;
-        mViewSpacingBottom = viewSpacingBottom;
-    }
-
-    /**
-     * Sets a hint for the best button panel layout.
-     */
-    public void setButtonPanelLayoutHint(int layoutHint) {
-        mButtonPanelLayoutHint = layoutHint;
-    }
-
-    /**
      * Sets a click listener or a message to be sent when the button is clicked.
      * You only need to pass one of {@code listener} or {@code msg}.
      *
@@ -374,7 +239,6 @@
      * @param listener The {@link DialogInterface.OnClickListener} to use.
      * @param msg The {@link Message} to be sent when clicked.
      */
-    @UnsupportedAppUsage
     public void setButton(int whichButton, CharSequence text,
             DialogInterface.OnClickListener listener, Message msg) {
 
@@ -410,7 +274,6 @@
      * @param resId the resource identifier of the drawable to use as the icon,
      *            or 0 for no icon
      */
-    @UnsupportedAppUsage
     public void setIcon(int resId) {
         mIcon = null;
         mIconId = resId;
@@ -430,7 +293,6 @@
      *
      * @param icon the drawable to use as the icon or null for no icon
      */
-    @UnsupportedAppUsage
     public void setIcon(Drawable icon) {
         mIcon = icon;
         mIconId = 0;
@@ -445,28 +307,6 @@
         }
     }
 
-    /**
-     * @param attrId the attributeId of the theme-specific drawable
-     * to resolve the resourceId for.
-     *
-     * @return resId the resourceId of the theme-specific drawable
-     */
-    public int getIconAttributeResId(int attrId) {
-        TypedValue out = new TypedValue();
-        mContext.getTheme().resolveAttribute(attrId, out, true);
-        return out.resourceId;
-    }
-
-    public void setInverseBackgroundForced(boolean forceInverseBackground) {
-        mForceInverseBackground = forceInverseBackground;
-    }
-
-    @UnsupportedAppUsage
-    public ListView getListView() {
-        return mListView;
-    }
-
-    @UnsupportedAppUsage
     public Button getButton(int whichButton) {
         switch (whichButton) {
             case DialogInterface.BUTTON_POSITIVE:
@@ -481,13 +321,11 @@
     }
 
     @SuppressWarnings({"UnusedDeclaration"})
-    @UnsupportedAppUsage
     public boolean onKeyDown(int keyCode, KeyEvent event) {
         return mScrollView != null && mScrollView.executeKeyEvent(event);
     }
 
     @SuppressWarnings({"UnusedDeclaration"})
-    @UnsupportedAppUsage
     public boolean onKeyUp(int keyCode, KeyEvent event) {
         return mScrollView != null && mScrollView.executeKeyEvent(event);
     }
@@ -536,7 +374,7 @@
 
         // Install custom content before setting up the title or buttons so
         // that we can handle panel overrides.
-        final ViewGroup customPanel = (ViewGroup) parentPanel.findViewById(R.id.customPanel);
+        final ViewGroup customPanel = parentPanel.findViewById(R.id.customPanel);
         setupCustomContent(customPanel);
 
         final View customTopPanel = customPanel.findViewById(R.id.topPanel);
@@ -566,17 +404,6 @@
             }
         }
 
-        // Only display the text spacer if we don't have buttons.
-        if (!hasButtonPanel) {
-            if (contentPanel != null) {
-                final View spacer = contentPanel.findViewById(R.id.textSpacerNoButtons);
-                if (spacer != null) {
-                    spacer.setVisibility(View.VISIBLE);
-                }
-            }
-            mWindow.setCloseOnTouchOutsideIfNotSet(true);
-        }
-
         if (hasTopPanel) {
             // Only clip scrolling content to padding if we have a title.
             if (mScrollView != null) {
@@ -585,16 +412,8 @@
 
             // Only show the divider if we have a title.
             View divider = null;
-            if (mMessage != null || mListView != null || hasCustomPanel) {
-                if (!hasCustomPanel) {
-                    divider = topPanel.findViewById(R.id.titleDividerNoCustom);
-                }
-                if (divider == null) {
-                    divider = topPanel.findViewById(R.id.titleDivider);
-                }
-
-            } else {
-                divider = topPanel.findViewById(R.id.titleDividerTop);
+            if (mMessage != null || hasCustomPanel) {
+                divider = topPanel.findViewById(R.id.titleDividerNoCustom);
             }
 
             if (divider != null) {
@@ -609,13 +428,9 @@
             }
         }
 
-        if (mListView instanceof RecycleListView) {
-            ((RecycleListView) mListView).setHasDecor(hasTopPanel, hasButtonPanel);
-        }
-
         // Update scroll indicators as needed.
         if (!hasCustomPanel) {
-            final View content = mListView != null ? mListView : mScrollView;
+            final View content = mScrollView;
             if (content != null) {
                 final int indicators = (hasTopPanel ? View.SCROLL_INDICATOR_TOP : 0)
                         | (hasButtonPanel ? View.SCROLL_INDICATOR_BOTTOM : 0);
@@ -632,16 +447,7 @@
     }
 
     private boolean requestFocusForContent(View content) {
-        if (content != null && content.requestFocus()) {
-            return true;
-        }
-
-        if (mListView != null) {
-            mListView.setSelection(0);
-            return true;
-        }
-
-        return false;
+        return content != null && content.requestFocus();
     }
 
     private void requestFocusForDefaultButton() {
@@ -672,117 +478,74 @@
         }
 
         if (hasCustomView) {
-            final FrameLayout custom = (FrameLayout) mWindow.findViewById(R.id.custom);
+            final FrameLayout custom = mWindow.findViewById(R.id.custom);
             custom.addView(customView, new LayoutParams(MATCH_PARENT, MATCH_PARENT));
 
             if (mViewSpacingSpecified) {
                 custom.setPadding(
                         mViewSpacingLeft, mViewSpacingTop, mViewSpacingRight, mViewSpacingBottom);
             }
-
-            if (mListView != null) {
-                ((LinearLayout.LayoutParams) customPanel.getLayoutParams()).weight = 0;
-            }
         } else {
             customPanel.setVisibility(View.GONE);
         }
     }
 
-    protected void setupTitle(ViewGroup topPanel) {
-        if (mCustomTitleView != null && mShowTitle) {
-            // Add the custom title view directly to the topPanel layout
-            final LayoutParams lp = new LayoutParams(
-                    LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
+    private void setupTitle(ViewGroup topPanel) {
+        mIconView = mWindow.findViewById(R.id.icon);
 
-            topPanel.addView(mCustomTitleView, 0, lp);
+        final boolean hasTextTitle = !TextUtils.isEmpty(mTitle);
+        if (hasTextTitle && mShowTitle) {
+            // Display the title if a title is supplied, else hide it.
+            mTitleView = mWindow.findViewById(R.id.alertTitle);
+            mTitleView.setText(mTitle);
 
+            // Do this last so that if the user has supplied any icons we
+            // use them instead of the default ones. If the user has
+            // specified 0 then make it disappear.
+            if (mIconId != 0) {
+                mIconView.setImageResource(mIconId);
+            } else if (mIcon != null) {
+                mIconView.setImageDrawable(mIcon);
+            } else {
+                // Apply the padding from the icon to ensure the title is
+                // aligned correctly.
+                mTitleView.setPadding(mIconView.getPaddingLeft(),
+                        mIconView.getPaddingTop(),
+                        mIconView.getPaddingRight(),
+                        mIconView.getPaddingBottom());
+                mIconView.setVisibility(View.GONE);
+            }
+        } else {
             // Hide the title template
             final View titleTemplate = mWindow.findViewById(R.id.title_template);
             titleTemplate.setVisibility(View.GONE);
-        } else {
-            mIconView = (ImageView) mWindow.findViewById(R.id.icon);
-
-            final boolean hasTextTitle = !TextUtils.isEmpty(mTitle);
-            if (hasTextTitle && mShowTitle) {
-                // Display the title if a title is supplied, else hide it.
-                mTitleView = (TextView) mWindow.findViewById(R.id.alertTitle);
-                mTitleView.setText(mTitle);
-
-                // Do this last so that if the user has supplied any icons we
-                // use them instead of the default ones. If the user has
-                // specified 0 then make it disappear.
-                if (mIconId != 0) {
-                    mIconView.setImageResource(mIconId);
-                } else if (mIcon != null) {
-                    mIconView.setImageDrawable(mIcon);
-                } else {
-                    // Apply the padding from the icon to ensure the title is
-                    // aligned correctly.
-                    mTitleView.setPadding(mIconView.getPaddingLeft(),
-                            mIconView.getPaddingTop(),
-                            mIconView.getPaddingRight(),
-                            mIconView.getPaddingBottom());
-                    mIconView.setVisibility(View.GONE);
-                }
-            } else {
-                // Hide the title template
-                final View titleTemplate = mWindow.findViewById(R.id.title_template);
-                titleTemplate.setVisibility(View.GONE);
-                mIconView.setVisibility(View.GONE);
-                topPanel.setVisibility(View.GONE);
-            }
+            mIconView.setVisibility(View.GONE);
+            topPanel.setVisibility(View.GONE);
         }
     }
 
-    protected void setupContent(ViewGroup contentPanel) {
-        mScrollView = (ScrollView) contentPanel.findViewById(R.id.scrollView);
+    private void setupContent(ViewGroup contentPanel) {
+        mScrollView = contentPanel.findViewById(R.id.scrollView);
         mScrollView.setFocusable(false);
 
         // Special case for users that only want to display a String
-        mMessageView = (TextView) contentPanel.findViewById(R.id.message);
+        mMessageView = contentPanel.findViewById(R.id.message);
         if (mMessageView == null) {
             return;
         }
 
-        if (mMessage != null) {
-            mMessageView.setText(mMessage);
-            if (mMessageMovementMethod != null) {
-                mMessageView.setMovementMethod(mMessageMovementMethod);
-            }
-            if (mMessageHyphenationFrequency != null) {
-                mMessageView.setHyphenationFrequency(mMessageHyphenationFrequency);
-            }
-        } else {
-            mMessageView.setVisibility(View.GONE);
-            mScrollView.removeView(mMessageView);
+        mMessageView.setVisibility(View.GONE);
+        mScrollView.removeView(mMessageView);
 
-            if (mListView != null) {
-                final ViewGroup scrollParent = (ViewGroup) mScrollView.getParent();
-                final int childIndex = scrollParent.indexOfChild(mScrollView);
-                scrollParent.removeViewAt(childIndex);
-                scrollParent.addView(mListView, childIndex,
-                        new LayoutParams(MATCH_PARENT, MATCH_PARENT));
-            } else {
-                contentPanel.setVisibility(View.GONE);
-            }
-        }
+        contentPanel.setVisibility(View.GONE);
     }
 
-    private static void manageScrollIndicators(View v, View upIndicator, View downIndicator) {
-        if (upIndicator != null) {
-            upIndicator.setVisibility(v.canScrollVertically(-1) ? View.VISIBLE : View.INVISIBLE);
-        }
-        if (downIndicator != null) {
-            downIndicator.setVisibility(v.canScrollVertically(1) ? View.VISIBLE : View.INVISIBLE);
-        }
-    }
-
-    protected void setupButtons(ViewGroup buttonPanel) {
+    private void setupButtons(ViewGroup buttonPanel) {
         int BIT_BUTTON_POSITIVE = 1;
         int BIT_BUTTON_NEGATIVE = 2;
         int BIT_BUTTON_NEUTRAL = 4;
         int whichButtons = 0;
-        mButtonPositive = (Button) buttonPanel.findViewById(R.id.button1);
+        mButtonPositive = buttonPanel.findViewById(R.id.button1);
         mButtonPositive.setOnClickListener(mButtonHandler);
 
         if (TextUtils.isEmpty(mButtonPositiveText)) {
@@ -793,7 +556,7 @@
             whichButtons = whichButtons | BIT_BUTTON_POSITIVE;
         }
 
-        mButtonNegative = (Button) buttonPanel.findViewById(R.id.button2);
+        mButtonNegative = buttonPanel.findViewById(R.id.button2);
         mButtonNegative.setOnClickListener(mButtonHandler);
 
         if (TextUtils.isEmpty(mButtonNegativeText)) {
@@ -805,7 +568,7 @@
             whichButtons = whichButtons | BIT_BUTTON_NEGATIVE;
         }
 
-        mButtonNeutral = (Button) buttonPanel.findViewById(R.id.button3);
+        mButtonNeutral = buttonPanel.findViewById(R.id.button3);
         mButtonNeutral.setOnClickListener(mButtonHandler);
 
         if (TextUtils.isEmpty(mButtonNeutralText)) {
@@ -817,41 +580,12 @@
             whichButtons = whichButtons | BIT_BUTTON_NEUTRAL;
         }
 
-        if (shouldCenterSingleButton(mContext)) {
-            /*
-             * If we only have 1 button it should be centered on the layout and
-             * expand to fill 50% of the available space.
-             */
-            if (whichButtons == BIT_BUTTON_POSITIVE) {
-                centerButton(mButtonPositive);
-            } else if (whichButtons == BIT_BUTTON_NEGATIVE) {
-                centerButton(mButtonNegative);
-            } else if (whichButtons == BIT_BUTTON_NEUTRAL) {
-                centerButton(mButtonNeutral);
-            }
-        }
-
         final boolean hasButtons = whichButtons != 0;
         if (!hasButtons) {
             buttonPanel.setVisibility(View.GONE);
         }
     }
 
-    private void centerButton(Button button) {
-        LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) button.getLayoutParams();
-        params.gravity = Gravity.CENTER_HORIZONTAL;
-        params.weight = 0.5f;
-        button.setLayoutParams(params);
-        View leftSpacer = mWindow.findViewById(R.id.leftSpacer);
-        if (leftSpacer != null) {
-            leftSpacer.setVisibility(View.VISIBLE);
-        }
-        View rightSpacer = mWindow.findViewById(R.id.rightSpacer);
-        if (rightSpacer != null) {
-            rightSpacer.setVisibility(View.VISIBLE);
-        }
-    }
-
     private void setBackground(TypedArray a, View topPanel, View contentPanel, View customPanel,
             View buttonPanel, boolean hasTitle, boolean hasCustomView, boolean hasButtons) {
         int fullDark = 0;
@@ -864,22 +598,6 @@
         int bottomBright = 0;
         int bottomMedium = 0;
 
-        // If the needsDefaultBackgrounds attribute is set, we know we're
-        // inheriting from a framework style.
-        final boolean needsDefaultBackgrounds = a.getBoolean(
-                R.styleable.AlertDialog_needsDefaultBackgrounds, true);
-        if (needsDefaultBackgrounds) {
-            fullDark = R.drawable.popup_full_dark;
-            topDark = R.drawable.popup_top_dark;
-            centerDark = R.drawable.popup_center_dark;
-            bottomDark = R.drawable.popup_bottom_dark;
-            fullBright = R.drawable.popup_full_bright;
-            topBright = R.drawable.popup_top_bright;
-            centerBright = R.drawable.popup_center_bright;
-            bottomBright = R.drawable.popup_bottom_bright;
-            bottomMedium = R.drawable.popup_bottom_medium;
-        }
-
         topBright = a.getResourceId(R.styleable.AlertDialog_topBright, topBright);
         topDark = a.getResourceId(R.styleable.AlertDialog_topDark, topDark);
         centerBright = a.getResourceId(R.styleable.AlertDialog_centerBright, centerBright);
@@ -907,16 +625,17 @@
 
         /* The contentPanel displays either a custom text message or
          * a ListView. If it's text we should use the dark background
-         * for ListView we should use the light background. If neither
+         * for ListView we should use the light background. PIA does not use
+         * a list view. Hence, we set it to use dark background.  If neither
          * are there the contentPanel will be hidden so set it as null.
          */
         views[pos] = contentPanel.getVisibility() == View.GONE ? null : contentPanel;
-        light[pos] = mListView != null;
+        light[pos] = false;
         pos++;
 
         if (hasCustomView) {
             views[pos] = customPanel;
-            light[pos] = mForceInverseBackground;
+            light[pos] = false;
             pos++;
         }
 
@@ -962,341 +681,5 @@
                 lastView.setBackgroundResource(lastLight ? fullBright : fullDark);
             }
         }
-
-        final ListView listView = mListView;
-        if (listView != null && mAdapter != null) {
-            listView.setAdapter(mAdapter);
-            final int checkedItem = mCheckedItem;
-            if (checkedItem > -1) {
-                listView.setItemChecked(checkedItem, true);
-                listView.setSelectionFromTop(checkedItem,
-                        a.getDimensionPixelSize(R.styleable.AlertDialog_selectionScrollOffset, 0));
-            }
-        }
-    }
-
-    public static class RecycleListView extends ListView {
-        private final int mPaddingTopNoTitle;
-        private final int mPaddingBottomNoButtons;
-
-        boolean mRecycleOnMeasure = true;
-
-        @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
-        public RecycleListView(Context context) {
-            this(context, null);
-        }
-
-        @UnsupportedAppUsage
-        public RecycleListView(Context context, AttributeSet attrs) {
-            super(context, attrs);
-
-            final TypedArray ta = context.obtainStyledAttributes(
-                    attrs, R.styleable.RecycleListView);
-            mPaddingBottomNoButtons = ta.getDimensionPixelOffset(
-                    R.styleable.RecycleListView_paddingBottomNoButtons, -1);
-            mPaddingTopNoTitle = ta.getDimensionPixelOffset(
-                    R.styleable.RecycleListView_paddingTopNoTitle, -1);
-        }
-
-        public void setHasDecor(boolean hasTitle, boolean hasButtons) {
-            if (!hasButtons || !hasTitle) {
-                final int paddingLeft = getPaddingLeft();
-                final int paddingTop = hasTitle ? getPaddingTop() : mPaddingTopNoTitle;
-                final int paddingRight = getPaddingRight();
-                final int paddingBottom = hasButtons ? getPaddingBottom() : mPaddingBottomNoButtons;
-                setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
-            }
-        }
-
-        @Override
-        protected boolean recycleOnMeasure() {
-            return mRecycleOnMeasure;
-        }
-    }
-
-    public static class AlertParams {
-        @UnsupportedAppUsage
-        public final Context mContext;
-        @UnsupportedAppUsage
-        public final LayoutInflater mInflater;
-
-        @UnsupportedAppUsage
-        public int mIconId = 0;
-        @UnsupportedAppUsage
-        public Drawable mIcon;
-        public int mIconAttrId = 0;
-        @UnsupportedAppUsage
-        public CharSequence mTitle;
-        @UnsupportedAppUsage
-        public View mCustomTitleView;
-        @UnsupportedAppUsage
-        public CharSequence mMessage;
-        @UnsupportedAppUsage
-        public CharSequence mPositiveButtonText;
-        @UnsupportedAppUsage
-        public DialogInterface.OnClickListener mPositiveButtonListener;
-        @UnsupportedAppUsage
-        public CharSequence mNegativeButtonText;
-        @UnsupportedAppUsage
-        public DialogInterface.OnClickListener mNegativeButtonListener;
-        @UnsupportedAppUsage
-        public CharSequence mNeutralButtonText;
-        @UnsupportedAppUsage
-        public DialogInterface.OnClickListener mNeutralButtonListener;
-        @UnsupportedAppUsage
-        public boolean mCancelable;
-        @UnsupportedAppUsage
-        public DialogInterface.OnCancelListener mOnCancelListener;
-        @UnsupportedAppUsage
-        public DialogInterface.OnDismissListener mOnDismissListener;
-        @UnsupportedAppUsage
-        public DialogInterface.OnKeyListener mOnKeyListener;
-        @UnsupportedAppUsage
-        public CharSequence[] mItems;
-        @UnsupportedAppUsage
-        public ListAdapter mAdapter;
-        @UnsupportedAppUsage
-        public DialogInterface.OnClickListener mOnClickListener;
-        public int mViewLayoutResId;
-        @UnsupportedAppUsage
-        public View mView;
-        public int mViewSpacingLeft;
-        public int mViewSpacingTop;
-        public int mViewSpacingRight;
-        public int mViewSpacingBottom;
-        public boolean mViewSpacingSpecified = false;
-        @UnsupportedAppUsage
-        public boolean[] mCheckedItems;
-        @UnsupportedAppUsage
-        public boolean mIsMultiChoice;
-        @UnsupportedAppUsage
-        public boolean mIsSingleChoice;
-        @UnsupportedAppUsage
-        public int mCheckedItem = -1;
-        @UnsupportedAppUsage
-        public DialogInterface.OnMultiChoiceClickListener mOnCheckboxClickListener;
-        @UnsupportedAppUsage
-        public Cursor mCursor;
-        @UnsupportedAppUsage
-        public String mLabelColumn;
-        @UnsupportedAppUsage
-        public String mIsCheckedColumn;
-        public boolean mForceInverseBackground;
-        @UnsupportedAppUsage
-        public AdapterView.OnItemSelectedListener mOnItemSelectedListener;
-        public OnPrepareListViewListener mOnPrepareListViewListener;
-        public boolean mRecycleOnMeasure = true;
-
-        /**
-         * Interface definition for a callback to be invoked before the ListView
-         * will be bound to an adapter.
-         */
-        public interface OnPrepareListViewListener {
-
-            /**
-             * Called before the ListView is bound to an adapter.
-             * @param listView The ListView that will be shown in the dialog.
-             */
-            void onPrepareListView(ListView listView);
-        }
-
-        @UnsupportedAppUsage
-        public AlertParams(Context context) {
-            mContext = context;
-            mCancelable = true;
-            mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-        }
-
-        @UnsupportedAppUsage
-        public void apply(AlertController dialog) {
-            if (mCustomTitleView != null) {
-                dialog.setCustomTitle(mCustomTitleView);
-            } else {
-                if (mTitle != null) {
-                    dialog.setTitle(mTitle);
-                }
-                if (mIcon != null) {
-                    dialog.setIcon(mIcon);
-                }
-                if (mIconId != 0) {
-                    dialog.setIcon(mIconId);
-                }
-                if (mIconAttrId != 0) {
-                    dialog.setIcon(dialog.getIconAttributeResId(mIconAttrId));
-                }
-            }
-            if (mMessage != null) {
-                dialog.setMessage(mMessage);
-            }
-            if (mPositiveButtonText != null) {
-                dialog.setButton(DialogInterface.BUTTON_POSITIVE, mPositiveButtonText,
-                        mPositiveButtonListener, null);
-            }
-            if (mNegativeButtonText != null) {
-                dialog.setButton(DialogInterface.BUTTON_NEGATIVE, mNegativeButtonText,
-                        mNegativeButtonListener, null);
-            }
-            if (mNeutralButtonText != null) {
-                dialog.setButton(DialogInterface.BUTTON_NEUTRAL, mNeutralButtonText,
-                        mNeutralButtonListener, null);
-            }
-            if (mForceInverseBackground) {
-                dialog.setInverseBackgroundForced(true);
-            }
-            // For a list, the client can either supply an array of items or an
-            // adapter or a cursor
-            if ((mItems != null) || (mCursor != null) || (mAdapter != null)) {
-                createListView(dialog);
-            }
-            if (mView != null) {
-                if (mViewSpacingSpecified) {
-                    dialog.setView(mView, mViewSpacingLeft, mViewSpacingTop, mViewSpacingRight,
-                            mViewSpacingBottom);
-                } else {
-                    dialog.setView(mView);
-                }
-            } else if (mViewLayoutResId != 0) {
-                dialog.setView(mViewLayoutResId);
-            }
-
-            /*
-            dialog.setCancelable(mCancelable);
-            dialog.setOnCancelListener(mOnCancelListener);
-            if (mOnKeyListener != null) {
-                dialog.setOnKeyListener(mOnKeyListener);
-            }
-            */
-        }
-
-        private void createListView(final AlertController dialog) {
-            final RecycleListView listView =
-                    (RecycleListView) mInflater.inflate(dialog.mListLayout, null);
-            final ListAdapter adapter;
-
-            if (mIsMultiChoice) {
-                if (mCursor == null) {
-                    adapter = new ArrayAdapter<CharSequence>(
-                            mContext, dialog.mMultiChoiceItemLayout, android.R.id.text1, mItems) {
-                        @Override
-                        public View getView(int position, View convertView, ViewGroup parent) {
-                            View view = super.getView(position, convertView, parent);
-                            if (mCheckedItems != null) {
-                                boolean isItemChecked = mCheckedItems[position];
-                                if (isItemChecked) {
-                                    listView.setItemChecked(position, true);
-                                }
-                            }
-                            return view;
-                        }
-                    };
-                } else {
-                    adapter = new CursorAdapter(mContext, mCursor, false) {
-                        private final int mLabelIndex;
-                        private final int mIsCheckedIndex;
-
-                        {
-                            final Cursor cursor = getCursor();
-                            mLabelIndex = cursor.getColumnIndexOrThrow(mLabelColumn);
-                            mIsCheckedIndex = cursor.getColumnIndexOrThrow(mIsCheckedColumn);
-                        }
-
-                        @Override
-                        public void bindView(View view, Context context, Cursor cursor) {
-                            CheckedTextView text = (CheckedTextView) view.findViewById(android.R.id.text1);
-                            text.setText(cursor.getString(mLabelIndex));
-                            listView.setItemChecked(
-                                    cursor.getPosition(),
-                                    cursor.getInt(mIsCheckedIndex) == 1);
-                        }
-
-                        @Override
-                        public View newView(Context context, Cursor cursor, ViewGroup parent) {
-                            return mInflater.inflate(dialog.mMultiChoiceItemLayout,
-                                    parent, false);
-                        }
-
-                    };
-                }
-            } else {
-                final int layout;
-                if (mIsSingleChoice) {
-                    layout = dialog.mSingleChoiceItemLayout;
-                } else {
-                    layout = dialog.mListItemLayout;
-                }
-
-                if (mCursor != null) {
-                    adapter = new SimpleCursorAdapter(mContext, layout, mCursor,
-                            new String[] { mLabelColumn }, new int[] { android.R.id.text1 });
-                } else if (mAdapter != null) {
-                    adapter = mAdapter;
-                } else {
-                    adapter = new CheckedItemAdapter(mContext, layout, android.R.id.text1, mItems);
-                }
-            }
-
-            if (mOnPrepareListViewListener != null) {
-                mOnPrepareListViewListener.onPrepareListView(listView);
-            }
-
-            /* Don't directly set the adapter on the ListView as we might
-             * want to add a footer to the ListView later.
-             */
-            dialog.mAdapter = adapter;
-            dialog.mCheckedItem = mCheckedItem;
-
-            if (mOnClickListener != null) {
-                listView.setOnItemClickListener(new OnItemClickListener() {
-                    @Override
-                    public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
-                        mOnClickListener.onClick(dialog.mDialogInterface, position);
-                        if (!mIsSingleChoice) {
-                            dialog.mDialogInterface.dismiss();
-                        }
-                    }
-                });
-            } else if (mOnCheckboxClickListener != null) {
-                listView.setOnItemClickListener(new OnItemClickListener() {
-                    @Override
-                    public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
-                        if (mCheckedItems != null) {
-                            mCheckedItems[position] = listView.isItemChecked(position);
-                        }
-                        mOnCheckboxClickListener.onClick(
-                                dialog.mDialogInterface, position, listView.isItemChecked(position));
-                    }
-                });
-            }
-
-            // Attach a given OnItemSelectedListener to the ListView
-            if (mOnItemSelectedListener != null) {
-                listView.setOnItemSelectedListener(mOnItemSelectedListener);
-            }
-
-            if (mIsSingleChoice) {
-                listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
-            } else if (mIsMultiChoice) {
-                listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
-            }
-            listView.mRecycleOnMeasure = mRecycleOnMeasure;
-            dialog.mListView = listView;
-        }
-    }
-
-    private static class CheckedItemAdapter extends ArrayAdapter<CharSequence> {
-        public CheckedItemAdapter(Context context, int resource, int textViewResourceId,
-                CharSequence[] objects) {
-            super(context, resource, textViewResourceId, objects);
-        }
-
-        @Override
-        public boolean hasStableIds() {
-            return true;
-        }
-
-        @Override
-        public long getItemId(int position) {
-            return position;
-        }
     }
 }
diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/AlertDialogLayout.java b/packages/PackageInstaller/src/com/android/packageinstaller/AlertDialogLayout.java
index 40fc406..e22171e 100644
--- a/packages/PackageInstaller/src/com/android/packageinstaller/AlertDialogLayout.java
+++ b/packages/PackageInstaller/src/com/android/packageinstaller/AlertDialogLayout.java
@@ -16,7 +16,6 @@
 
 package com.android.packageinstaller;
 
-import android.compat.annotation.UnsupportedAppUsage;
 import android.content.Context;
 import android.graphics.drawable.Drawable;
 import android.util.AttributeSet;
@@ -52,7 +51,6 @@
         super(context);
     }
 
-    @UnsupportedAppUsage
     public AlertDialogLayout(@Nullable Context context, @Nullable AttributeSet attrs) {
         super(context, attrs);
     }
@@ -346,10 +344,6 @@
                         break;
                 }
 
-                if (hasDividerBeforeChildAt(i)) {
-                    childTop += dividerHeight;
-                }
-
                 childTop += lp.topMargin;
                 setChildFrame(child, childLeft, childTop, childWidth, childHeight);
                 childTop += childHeight + lp.bottomMargin;
diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/ButtonBarLayout.java b/packages/PackageInstaller/src/com/android/packageinstaller/ButtonBarLayout.java
index 826c076..8d478c4 100644
--- a/packages/PackageInstaller/src/com/android/packageinstaller/ButtonBarLayout.java
+++ b/packages/PackageInstaller/src/com/android/packageinstaller/ButtonBarLayout.java
@@ -16,7 +16,6 @@
 
 package com.android.packageinstaller;
 
-import android.compat.annotation.UnsupportedAppUsage;
 import android.content.Context;
 import android.content.res.TypedArray;
 import android.util.AttributeSet;
@@ -41,7 +40,6 @@
 
     private int mMinimumHeight = 0;
 
-    @UnsupportedAppUsage
     public ButtonBarLayout(Context context, AttributeSet attrs) {
         super(context, attrs);
 
diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/DialogTitle.java b/packages/PackageInstaller/src/com/android/packageinstaller/DialogTitle.java
index 921a904..068834c 100644
--- a/packages/PackageInstaller/src/com/android/packageinstaller/DialogTitle.java
+++ b/packages/PackageInstaller/src/com/android/packageinstaller/DialogTitle.java
@@ -16,7 +16,6 @@
 
 package com.android.packageinstaller;
 
-import android.compat.annotation.UnsupportedAppUsage;
 import android.content.Context;
 import android.content.res.TypedArray;
 import android.text.Layout;
@@ -39,7 +38,6 @@
         super(context, attrs, defStyleAttr);
     }
 
-    @UnsupportedAppUsage
     public DialogTitle(Context context, AttributeSet attrs) {
         super(context, attrs);
     }
diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/MicroAlertController.java b/packages/PackageInstaller/src/com/android/packageinstaller/MicroAlertController.java
deleted file mode 100644
index 0d77f35..0000000
--- a/packages/PackageInstaller/src/com/android/packageinstaller/MicroAlertController.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.packageinstaller;
-
-import android.content.Context;
-import android.content.DialogInterface;
-import android.view.Gravity;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.Window;
-import android.widget.FrameLayout;
-import android.widget.ScrollView;
-import android.widget.TextView;
-
-
-public class MicroAlertController extends AlertController {
-    public MicroAlertController(Context context, DialogInterface di, Window window) {
-        super(context, di, window);
-    }
-
-    @Override
-    protected void setupContent(ViewGroup contentPanel) {
-        // Special case for small screen - the scroll view is higher in hierarchy
-        mScrollView = (ScrollView) mWindow.findViewById(R.id.scrollView);
-
-        // Special case for users that only want to display a String
-        mMessageView = (TextView) contentPanel.findViewById(R.id.message);
-        if (mMessageView == null) {
-            return;
-        }
-
-        if (mMessage != null) {
-            mMessageView.setText(mMessage);
-        } else {
-            // no message, remove associated views
-            mMessageView.setVisibility(View.GONE);
-            contentPanel.removeView(mMessageView);
-
-            if (mListView != null) {
-                // has ListView, swap scrollView with ListView
-
-                // move topPanel into top of scrollParent
-                View topPanel = mScrollView.findViewById(R.id.topPanel);
-                ((ViewGroup) topPanel.getParent()).removeView(topPanel);
-                FrameLayout.LayoutParams topParams =
-                        new FrameLayout.LayoutParams(topPanel.getLayoutParams());
-                topParams.gravity = Gravity.TOP;
-                topPanel.setLayoutParams(topParams);
-
-                // move buttonPanel into bottom of scrollParent
-                View buttonPanel = mScrollView.findViewById(R.id.buttonPanel);
-                ((ViewGroup) buttonPanel.getParent()).removeView(buttonPanel);
-                FrameLayout.LayoutParams buttonParams =
-                        new FrameLayout.LayoutParams(buttonPanel.getLayoutParams());
-                buttonParams.gravity = Gravity.BOTTOM;
-                buttonPanel.setLayoutParams(buttonParams);
-
-                // remove scrollview
-                final ViewGroup scrollParent = (ViewGroup) mScrollView.getParent();
-                final int childIndex = scrollParent.indexOfChild(mScrollView);
-                scrollParent.removeViewAt(childIndex);
-
-                // add list view
-                scrollParent.addView(mListView,
-                        new ViewGroup.LayoutParams(
-                                ViewGroup.LayoutParams.MATCH_PARENT,
-                                ViewGroup.LayoutParams.MATCH_PARENT));
-
-                // add top and button panel
-                scrollParent.addView(topPanel);
-                scrollParent.addView(buttonPanel);
-            } else {
-                // no content, just hide everything
-                contentPanel.setVisibility(View.GONE);
-            }
-        }
-    }
-
-    @Override
-    protected void setupTitle(ViewGroup topPanel) {
-        super.setupTitle(topPanel);
-        if (topPanel.getVisibility() == View.GONE) {
-            topPanel.setVisibility(View.INVISIBLE);
-        }
-    }
-
-    @Override
-    protected void setupButtons(ViewGroup buttonPanel) {
-        super.setupButtons(buttonPanel);
-        if (buttonPanel.getVisibility() == View.GONE) {
-            buttonPanel.setVisibility(View.INVISIBLE);
-        }
-    }
-}