Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d25ec877 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Make package installer a sequence of alert-dialogs.

To make sure the dialog does not change height a single content for all
steps of the sequence. We just unhide the view that should actually be
shown.

Also added a night-mode theme.

Test: Manually uninstalled, installed and update package.
      atest CtsNoPermissionTestCases
            CtsNoPermissionTestCases25
	    CtsPackageInstallTestCases
	    CtsPackageUninstallTestCases
	    CtsPackageInstallerTapjackingTestCases
Change-Id: I890bb1f2697df3af87b6cb65e460f611334523ee
parent bcd72a50
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@
            android:label="@string/app_name"
            android:icon="@drawable/ic_app_icon"
            android:allowBackup="false"
            android:theme="@style/DialogWhenLarge"
            android:theme="@style/Theme.AlertDialogActivity"
            android:supportsRtl="true"
            android:defaultToDeviceProtectedStorage="true"
            android:directBootAware="true">
@@ -32,6 +32,7 @@
        </receiver>

        <activity android:name=".InstallStart"
                android:theme="@android:style/Theme.Translucent.NoTitleBar"
                android:exported="true"
                android:excludeFromRecents="true">
            <intent-filter android:priority="1">
@@ -59,13 +60,14 @@
                android:exported="false" />

        <activity android:name=".DeleteStagedFileOnResult"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
            android:exported="false" />

        <activity android:name=".PackageInstallerActivity"
                android:exported="false" />

        <activity android:name=".InstallInstalling"
                android:theme="@style/DialogWhenLargeNoAnimation"
                android:theme="@style/Theme.AlertDialogActivity.NoAnimation"
                android:exported="false" />

        <receiver android:name=".InstallEventReceiver"
@@ -77,18 +79,17 @@
        </receiver>

        <activity android:name=".InstallSuccess"
                android:theme="@style/DialogWhenLargeNoAnimation"
                android:theme="@style/Theme.AlertDialogActivity.NoAnimation"
                android:exported="false" />

        <activity android:name=".InstallFailed"
                android:theme="@style/DialogWhenLargeNoAnimation"
                android:theme="@style/Theme.AlertDialogActivity.NoAnimation"
                android:exported="false" />

        <activity android:name=".UninstallerActivity"
                android:configChanges="orientation|keyboardHidden|screenSize"
                android:excludeFromRecents="true"
                android:noHistory="true"
                android:theme="@style/AlertDialogActivity">
                android:noHistory="true">
            <intent-filter android:priority="1">
                <action android:name="android.intent.action.DELETE" />
                <action android:name="android.intent.action.UNINSTALL_PACKAGE" />
@@ -107,7 +108,6 @@

        <activity android:name=".UninstallUninstalling"
            android:excludeFromRecents="true"
            android:theme="@style/AlertDialogActivity"
            android:exported="false" />

        <receiver android:name=".UninstallFinish"
+0 −91
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  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.
  -->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <LinearLayout android:id="@+id/app_snippet"
        android:background="?android:attr/colorPrimary"
        android:layout_width="match_parent"
        android:layout_height="?android:attr/actionBarSize"
        android:orientation="horizontal"
        android:elevation="@dimen/headerElevation"
        android:gravity="center_vertical">

        <ImageView android:id="@+id/app_icon"
            android:layout_marginStart="16dp"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:scaleType="fitCenter"
            android:src="@drawable/ic_file_download" />

        <TextView android:id="@+id/app_name"
            android:layout_marginStart="32dp"
            android:layout_marginEnd="16dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/titleTextStyle"
            android:singleLine="true"
            android:text="@string/app_name_unknown"
            android:ellipsize="end" />

    </LinearLayout>

    <ScrollView android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:padding="16dip">

        <TextView android:id="@+id/install_confirm_question"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium" />

    </ScrollView>

    <LinearLayout style="?android:attr/buttonBarStyle"
        android:background="?android:attr/colorBackground"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:padding="8dp"
        android:measureWithLargestChild="true">

        <!-- spacer to push buttons to the right -->
        <View android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <Button android:id="@+id/cancel_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/cancel"
            android:maxLines="2"
            style="?android:attr/buttonBarButtonStyle" />

        <Button android:id="@+id/ok_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/install"
            android:maxLines="2"
            style="?android:attr/buttonBarButtonStyle" />

    </LinearLayout>

</LinearLayout>
+144 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2018 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.
  -->

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="?android:attr/alertDialogTheme"
    android:paddingTop="8dp"
    android:paddingLeft="?android:attr/dialogPreferredPadding"
    android:paddingRight="?android:attr/dialogPreferredPadding">

    <LinearLayout
        android:id="@+id/staging"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:visibility="invisible">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@android:style/TextAppearance.Material.Subhead"
            android:text="@string/message_staging" />

        <ProgressBar
            android:id="@+id/progress_indeterminate"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingTop="8dp"
            style="?android:attr/progressBarStyleHorizontal"
            android:indeterminate="true" />

    </LinearLayout>

    <LinearLayout
        android:id="@+id/installing"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:visibility="invisible">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@android:style/TextAppearance.Material.Subhead"
            android:text="@string/installing" />

        <ProgressBar
            android:id="@+id/progress"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingTop="8dp"
            style="?android:attr/progressBarStyleHorizontal" />

    </LinearLayout>

    <TextView
        android:id="@+id/install_confirm_question"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        style="@android:style/TextAppearance.Material.Subhead"
        android:text="@string/install_confirm_question"
        android:visibility="invisible" />

    <TextView
        android:id="@+id/install_confirm_question_update"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        style="@android:style/TextAppearance.Material.Subhead"
        android:text="@string/install_confirm_question_update"
        android:visibility="invisible" />

    <TextView
        android:id="@+id/install_confirm_question_update_system"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        style="@android:style/TextAppearance.Material.Subhead"
        android:text="@string/install_confirm_question_update_system"
        android:visibility="invisible" />

    <TextView
        android:id="@+id/install_success"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        style="@android:style/TextAppearance.Material.Subhead"
        android:text="@string/install_done"
        android:visibility="invisible" />

    <TextView
        android:id="@+id/install_failed"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        style="@android:style/TextAppearance.Material.Subhead"
        android:text="@string/install_failed"
        android:visibility="invisible" />

    <TextView
        android:id="@+id/install_failed_blocked"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        style="@android:style/TextAppearance.Material.Subhead"
        android:text="@string/install_failed_blocked"
        android:visibility="invisible" />

    <TextView
        android:id="@+id/install_failed_conflict"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        style="@android:style/TextAppearance.Material.Subhead"
        android:text="@string/install_failed_conflict"
        android:visibility="invisible" />

    <TextView
        android:id="@+id/install_failed_incompatible"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        style="@android:style/TextAppearance.Material.Subhead"
        android:text="@string/install_failed_incompatible"
        android:visibility="invisible" />

    <TextView
        android:id="@+id/install_failed_invalid_apk"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        style="@android:style/TextAppearance.Material.Subhead"
        android:text="@string/install_failed_invalid_apk"
        android:visibility="invisible" />

</FrameLayout>
+0 −96
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  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.
  -->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

    <LinearLayout android:id="@+id/app_snippet"
            android:background="?android:attr/colorPrimary"
            android:layout_width="match_parent"
            android:layout_height="?android:attr/actionBarSize"
            android:orientation="horizontal"
            android:elevation="@dimen/headerElevation"
            android:gravity="center_vertical">

        <ImageView android:id="@+id/app_icon"
                android:layout_marginStart="16dp"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:scaleType="fitCenter" />

        <TextView android:id="@+id/app_name"
                android:layout_marginStart="32dp"
                android:layout_marginEnd="16dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/titleTextStyle"
                android:singleLine="true"
                android:ellipsize="end" />

    </LinearLayout>

    <LinearLayout android:id="@+id/simple_status_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="vertical"
            android:paddingLeft="16dip"
            android:paddingRight="16dip">

        <ImageView android:id="@+id/center_icon"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="12dp"
                android:src="@drawable/ic_report_problem_92"
                android:tint="@color/bigIconColor"
                android:contentDescription="@null" />

        <TextView android:id="@+id/simple_status"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceMedium" />

    </LinearLayout>

    <LinearLayout android:id="@+id/buttons_panel"
            style="?android:attr/buttonBarStyle"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:measureWithLargestChild="true"
            android:padding="8dip">

        <!-- spacer to push button to the right -->
        <View android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_weight="1" />

        <Button android:id="@+id/done_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/done"
                android:maxLines="2"
                style="?android:attr/buttonBarButtonStyle" />

    </LinearLayout>

</LinearLayout>

+0 −108
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>

<!-- 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.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

    <LinearLayout android:id="@+id/app_snippet"
            android:background="?android:attr/colorPrimary"
            android:layout_width="match_parent"
            android:layout_height="?android:attr/actionBarSize"
            android:orientation="horizontal"
            android:elevation="@dimen/headerElevation"
            android:gravity="center_vertical">

        <ImageView
                android:id="@+id/app_icon"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:layout_marginStart="16dp"
                android:scaleType="fitCenter" />

        <TextView
                android:id="@+id/app_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="32dp"
                android:layout_marginEnd="16dp"
                android:ellipsize="end"
                android:singleLine="true"
                android:textAppearance="?android:attr/titleTextStyle" />

    </LinearLayout>

    <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="vertical"
            android:paddingLeft="16dip"
            android:paddingRight="16dip">

        <ImageView
                android:layout_width="92dp"
                android:layout_height="92dp"
                android:layout_marginBottom="12dp"
                android:contentDescription="@null"
                android:tint="@color/bigIconColor"
                android:src="@drawable/ic_file_download" />

        <ProgressBar
                android:id="@+id/progress_bar"
                style="?android:attr/progressBarStyleHorizontal"
                android:layout_width="250dp"
                android:layout_height="wrap_content"
                android:indeterminate="false" />

        <TextView
                android:id="@+id/center_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:text="@string/installing"
                android:textAppearance="?android:attr/textAppearanceMedium" />

    </LinearLayout>

    <LinearLayout
            android:id="@+id/buttons_panel"
            style="?android:attr/buttonBarStyle"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:measureWithLargestChild="true"
            android:orientation="horizontal"
            android:padding="8dip">

        <View
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_weight="1" />

        <Button
                android:id="@+id/cancel_button"
                style="?android:attr/buttonBarButtonStyle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:maxLines="2"
                android:text="@string/cancel" />

    </LinearLayout>

</LinearLayout>
Loading