aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Martinz <eviscerationls@gmail.com>2016-07-28 14:02:08 +0200
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-08-10 16:52:21 -0700
commit6e5ab27fbb508b3b347c873c0a3d9848ced789e9 (patch)
tree1861de109efdc676e2872f758be9b1d5d46c5979
parentdb640a9648d7833eb0f9745b091c91e7f3768803 (diff)
downloadvendor_cmsdk-6e5ab27fbb508b3b347c873c0a3d9848ced789e9.zip
vendor_cmsdk-6e5ab27fbb508b3b347c873c0a3d9848ced789e9.tar.gz
vendor_cmsdk-6e5ab27fbb508b3b347c873c0a3d9848ced789e9.tar.bz2
[1/2] cmsdk: cm custom boot dexopt UI
* Pass app info and number of installed packages to boot message UI * Ui by Asher and Joey, based on Alexander's previous work Change-Id: I9298d7e2b85a703921abf62f8b91157e6f88803b Signed-off-by: Joey Rizzoli <joey@cyanogenmoditalia.it>
-rw-r--r--api/cm_current.txt16
-rw-r--r--cm/res/res/drawable/dexopt_brand_logo.xml35
-rw-r--r--cm/res/res/drawable/ic_device.xml28
-rw-r--r--cm/res/res/drawable/ic_device_bg.xml26
-rw-r--r--cm/res/res/drawable/ic_dexopt_obscured.xml27
-rw-r--r--cm/res/res/drawable/ic_dexopt_starting.xml27
-rw-r--r--cm/res/res/drawable/ic_droid.xml35
-rw-r--r--cm/res/res/drawable/ic_droid_bg.xml26
-rw-r--r--cm/res/res/layout/dexopt_dialog.xml90
-rw-r--r--cm/res/res/values/colors.xml30
-rw-r--r--cm/res/res/values/config.xml3
-rw-r--r--cm/res/res/values/dimens.xml22
-rw-r--r--cm/res/res/values/strings.xml9
-rw-r--r--cm/res/res/values/symbols.xml23
-rw-r--r--sdk/src/java/org/cyanogenmod/internal/BootDexoptDialog.java173
-rw-r--r--system-api/cm_system-current.txt16
16 files changed, 586 insertions, 0 deletions
diff --git a/api/cm_current.txt b/api/cm_current.txt
index a93f52f..5a57e67 100644
--- a/api/cm_current.txt
+++ b/api/cm_current.txt
@@ -742,14 +742,30 @@ package cyanogenmod.platform {
ctor public R.bool();
}
+ public static final class R.color {
+ ctor public R.color();
+ }
+
+ public static final class R.dimen {
+ ctor public R.dimen();
+ }
+
public static final class R.drawable {
ctor public R.drawable();
}
+ public static final class R.id {
+ ctor public R.id();
+ }
+
public static final class R.integer {
ctor public R.integer();
}
+ public static final class R.layout {
+ ctor public R.layout();
+ }
+
public static final class R.string {
ctor public R.string();
}
diff --git a/cm/res/res/drawable/dexopt_brand_logo.xml b/cm/res/res/drawable/dexopt_brand_logo.xml
new file mode 100644
index 0000000..07afe03
--- /dev/null
+++ b/cm/res/res/drawable/dexopt_brand_logo.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2016 The CyanogenMod 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="96dp"
+ android:height="90dp"
+ android:viewportWidth="96"
+ android:viewportHeight="90">
+
+ <path
+ android:fillColor="@color/dexopt_logo"
+ android:pathData="M96.1,38.6v18.8v4.9v5.4c0,16.8-16.2,21.7-45.2,22h-0.1c-0.9,0-1.8,0-2.7,0v0h0v0c-0.9,0-1.8,0-2.7,0h-1.7v0
+c-28-0.5-43.6-5.5-43.6-22v-5.4v-4.9V38.6c0-9,4.6-14.6,13.4-17.9L6.9,4.7C6.3,3,7,1.2,8.6,0.6c1.6-0.7,3.4,0.1,4.1,1.7l6.8,16.7
+c6.5-1.5,14.6-2.2,24.2-2.3h0c1.4,0,2.9,0,4.4,0v0h0v0c11.5,0,21.1,0.7,28.6,2.4l6.8-16.6c0.7-1.6,2.5-2.4,4.1-1.7
+C89.2,1.2,90,3,89.4,4.7l-6.6,16.1C91.5,24,96.1,29.6,96.1,38.6z
+M23.5,38.3c-7.9,0-14.4,6.4-14.4,14.4c0,7.9,6.4,14.4,14.4,14.4
+c7.9,0,14.4-6.4,14.4-14.4C37.8,44.7,31.4,38.3,23.5,38.3z
+M72.8,38.3c-7.9,0-14.4,6.4-14.4,14.4c0,7.9,6.4,14.4,14.4,14.4
+c7.9,0,14.4-6.4,14.4-14.4C87.2,44.7,80.7,38.3,72.8,38.3z
+M42.6,73.1c0,0.1,0,0.2,0,0.2c0,2.2,1.8,4,4,4h3c2.2,0,4-1.8,4-4
+c0-0.1,0-0.2,0-0.2H42.6z" />
+</vector>
diff --git a/cm/res/res/drawable/ic_device.xml b/cm/res/res/drawable/ic_device.xml
new file mode 100644
index 0000000..be88d71
--- /dev/null
+++ b/cm/res/res/drawable/ic_device.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2016 The CyanogenMod 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="@color/white"
+ android:pathData="M17.2,18H6.8V4h10.5V18z M14,21h-4v-1h4V21z
+M16,1H8C6.3,1,5,2.3,5,4v16c0,1.7,1.3,3,3,3h8c1.7,0,3-1.3,3-3V4
+C19,2.3,17.7,1,16,1z" />
+</vector>
diff --git a/cm/res/res/drawable/ic_device_bg.xml b/cm/res/res/drawable/ic_device_bg.xml
new file mode 100644
index 0000000..3336946
--- /dev/null
+++ b/cm/res/res/drawable/ic_device_bg.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2016 The CyanogenMod 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="@color/dexopt_device_bg"
+ android:fillAlpha="1"
+ android:pathData="M12,12m-10,0a10,10 0,1 1,20 0a10,10 0,1 1,-20 0"/>
+</vector>
diff --git a/cm/res/res/drawable/ic_dexopt_obscured.xml b/cm/res/res/drawable/ic_dexopt_obscured.xml
new file mode 100644
index 0000000..14c5fef
--- /dev/null
+++ b/cm/res/res/drawable/ic_dexopt_obscured.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2016 The CyanogenMod 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.
+-->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:height="48dp"
+ android:width="48dp"
+ android:drawable="@drawable/ic_droid_bg"/>
+ <item
+ android:height="24dp"
+ android:width="24dp"
+ android:gravity="center"
+ android:drawable="@drawable/ic_droid" />
+</layer-list>
diff --git a/cm/res/res/drawable/ic_dexopt_starting.xml b/cm/res/res/drawable/ic_dexopt_starting.xml
new file mode 100644
index 0000000..09b4a3a
--- /dev/null
+++ b/cm/res/res/drawable/ic_dexopt_starting.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2016 The CyanogenMod 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.
+-->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:height="48dp"
+ android:width="48dp"
+ android:drawable="@drawable/ic_device_bg"/>
+ <item
+ android:height="24dp"
+ android:width="24dp"
+ android:gravity="center"
+ android:drawable="@drawable/ic_device" />
+</layer-list>
diff --git a/cm/res/res/drawable/ic_droid.xml b/cm/res/res/drawable/ic_droid.xml
new file mode 100644
index 0000000..9ce3a65
--- /dev/null
+++ b/cm/res/res/drawable/ic_droid.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2016 The CyanogenMod 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="@color/white"
+ android:pathData="M15,5h-1V4h1V5z M13,12v-2h-2v2H9v2h2v2h2v-2h2v-2H13z M10,5H9V4h1V5z
+M15.5,2.2l1.3-1.3c0.2-0.2,0.2-0.5,0-0.7
+c-0.2-0.2-0.5-0.2-0.7,0l-1.5,1.5C13.9,1.2,12.9,1,12,1c-1,0-1.9,0.2-2.7,0.6L7.8,0.1C7.7,0,7.3,0,7.1,0.1c-0.2,0.2-0.2,0.5,0,0.7
+l1.3,1.3C7,3.3,6,5,6,7h12C18,5,17,3.2,15.5,2.2z
+M20.5,8C19.7,8,19,8.7,19,9.5v7c0,0.8,0.7,1.5,1.5,1.5s1.5-0.7,1.5-1.5v-7
+C22,8.7,21.3,8,20.5,8z
+M3.5,8C2.7,8,2,8.7,2,9.5v7C2,17.3,2.7,18,3.5,18S5,17.3,5,16.5v-7C5,8.7,4.3,8,3.5,8z
+M6,18
+c0,0.5,0.4,1,1,1h1v3.5C8,23.3,8.7,24,9.5,24s1.5-0.7,1.5-1.5V19h2v3.5c0,0.8,0.7,1.5,1.5,1.5s1.5-0.7,1.5-1.5V19h1c0.5,0,1-0.5,1-1
+V8H6V18z" />
+</vector>
diff --git a/cm/res/res/drawable/ic_droid_bg.xml b/cm/res/res/drawable/ic_droid_bg.xml
new file mode 100644
index 0000000..4c537fa
--- /dev/null
+++ b/cm/res/res/drawable/ic_droid_bg.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2016 The CyanogenMod 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="@color/dexopt_obscured_bg"
+ android:fillAlpha="1"
+ android:pathData="M12,12m-10,0a10,10 0,1 1,20 0a10,10 0,1 1,-20 0"/>
+</vector>
diff --git a/cm/res/res/layout/dexopt_dialog.xml b/cm/res/res/layout/dexopt_dialog.xml
new file mode 100644
index 0000000..a8707ca
--- /dev/null
+++ b/cm/res/res/layout/dexopt_dialog.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2016 The CyanogenMod 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:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/dexopt_bottom"
+ android:gravity="bottom">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/dexopt_background"
+ android:elevation="8dp">
+
+ <ImageView
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:paddingTop="@dimen/dexopt_bottom_height"
+ android:scaleType="centerInside"
+ android:layout_gravity="center"
+ android:src="@drawable/dexopt_brand_logo"
+ android:layout_weight="1" />
+ </LinearLayout>
+ <ProgressBar
+ android:id="@+id/dexopt_progress"
+ android:layout_width="match_parent"
+ android:layout_height="8dp"
+ android:indeterminate="false"
+ android:progress="10"
+ style="@android:style/Widget.Material.ProgressBar.Horizontal" />
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dexopt_bottom_height"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:padding="@dimen/dexopt_padding_generic">
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:layout_gravity="center_vertical"
+ android:orientation="vertical">
+ <TextView
+ android:id="@+id/dexopt_message"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="@color/dexopt_text_primary"
+ android:ellipsize="marquee"
+ android:maxLines="1"
+ android:scrollHorizontally="true"
+ android:marqueeRepeatLimit="marquee_forever"
+ android:textSize="14sp" />
+ <TextView
+ android:id="@+id/dexopt_message_detail"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="@color/dexopt_text_secondary"
+ android:ellipsize="marquee"
+ android:maxLines="1"
+ android:scrollHorizontally="true"
+ android:marqueeRepeatLimit="marquee_forever"
+ android:textSize="14sp" />
+ </LinearLayout>
+ <ImageView
+ android:id="@+id/dexopt_icon"
+ android:layout_height="@dimen/dexopt_icon_size"
+ android:layout_width="@dimen/dexopt_icon_size"
+ android:layout_gravity="center_vertical" />
+ </LinearLayout>
+ </LinearLayout>
+</LinearLayout>
diff --git a/cm/res/res/values/colors.xml b/cm/res/res/values/colors.xml
new file mode 100644
index 0000000..7bf309f
--- /dev/null
+++ b/cm/res/res/values/colors.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 The CyanogenMod 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.
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <color name="white">#ffffff</color>
+ <color name="black">#000000</color>
+ <color name="cm_cyan">#2baae2</color>
+
+ <!-- Boot dexopt layout -->
+ <color name="dexopt_background">@color/black</color>
+ <color name="dexopt_bottom">#212121</color>
+ <color name="dexopt_text_primary">#deffffff</color>
+ <color name="dexopt_text_secondary">#8affffff</color>
+ <color name="dexopt_logo">#212121</color>
+ <color name="dexopt_device_bg">@color/cm_cyan</color>
+ <color name="dexopt_obscured_bg">#757575</color>
+</resources>
diff --git a/cm/res/res/values/config.xml b/cm/res/res/values/config.xml
index b9e05d5..1b0d6a8 100644
--- a/cm/res/res/values/config.xml
+++ b/cm/res/res/values/config.xml
@@ -129,4 +129,7 @@
<!-- The CMSystemServer class that is invoked from Android's SystemServer -->
<string name="config_externalSystemServer" translatable="false">org.cyanogenmod.platform.internal.CMSystemServer</string>
+
+ <!-- Whether to show icon and name of optimized apps on the boot dexopt screen. -->
+ <bool name="config_bootDexoptHideAppDetails">false</bool>
</resources>
diff --git a/cm/res/res/values/dimens.xml b/cm/res/res/values/dimens.xml
new file mode 100644
index 0000000..4a0c278
--- /dev/null
+++ b/cm/res/res/values/dimens.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 The CyanogenMod 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.
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Boot dexopt layout -->
+ <dimen name="dexopt_bottom_height">96dp</dimen>
+ <dimen name="dexopt_padding_generic">24dp</dimen>
+ <dimen name="dexopt_icon_size">48dp</dimen>
+</resources>
diff --git a/cm/res/res/values/strings.xml b/cm/res/res/values/strings.xml
index 19e5569..8e3c4e7 100644
--- a/cm/res/res/values/strings.xml
+++ b/cm/res/res/values/strings.xml
@@ -226,4 +226,13 @@
<string name="qs_themes_label">Themes</string>
<string name="qs_themes_content_description">Customize your theme</string>
+ <!-- Custom booot dexopt -->
+ <string name="android_upgrading_starting_apps">Starting apps\u2026</string>
+ <string name="android_upgrading_fstrim">Optimizing storage\u2026</string>
+ <string name="android_upgrading_complete">Preparing to start\u2026</string>
+ <string name="android_upgrading_complete_details">Optimization completed.</string>
+ <string name="android_preparing_apk">Preparing %1$s\u2026</string>
+ <string name="android_preparing_apk_obscured">Preparing apps\u2026</string>
+ <string name="android_upgrading_apk">%1$d of %2$d apps</string>
+
</resources>
diff --git a/cm/res/res/values/symbols.xml b/cm/res/res/values/symbols.xml
index 7c19dc8..c183713 100644
--- a/cm/res/res/values/symbols.xml
+++ b/cm/res/res/values/symbols.xml
@@ -128,4 +128,27 @@
<!-- CM system server -->
<java-symbol type="string" name="config_externalSystemServer" />
+
+ <!-- Boot dexopt dialog -->
+ <java-symbol type="bool" name="config_bootDexoptHideAppDetails" />
+ <java-symbol type="drawable" name="dexopt_brand_logo" />
+ <java-symbol type="drawable" name="ic_device_bg" />
+ <java-symbol type="drawable" name="ic_device" />
+ <java-symbol type="drawable" name="ic_dexopt_obscured" />
+ <java-symbol type="drawable" name="ic_dexopt_starting" />
+ <java-symbol type="drawable" name="ic_droid_bg" />
+ <java-symbol type="drawable" name="ic_droid" />
+ <java-symbol type="layout" name="dexopt_dialog" />
+ <java-symbol type="id" name="dexopt_icon" />
+ <java-symbol type="id" name="dexopt_message" />
+ <java-symbol type="id" name="dexopt_message_detail" />
+ <java-symbol type="id" name="dexopt_progress" />
+ <java-symbol type="string" name="android_upgrading_starting_apps" />
+ <java-symbol type="string" name="android_upgrading_fstrim" />
+ <java-symbol type="string" name="android_upgrading_complete" />
+ <java-symbol type="string" name="android_upgrading_complete_details" />
+ <java-symbol type="string" name="android_preparing_apk" />
+ <java-symbol type="string" name="android_preparing_apk_obscured" />
+ <java-symbol type="string" name="android_upgrading_apk" />
+
</resources>
diff --git a/sdk/src/java/org/cyanogenmod/internal/BootDexoptDialog.java b/sdk/src/java/org/cyanogenmod/internal/BootDexoptDialog.java
new file mode 100644
index 0000000..89dd676
--- /dev/null
+++ b/sdk/src/java/org/cyanogenmod/internal/BootDexoptDialog.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright (C) 2016 The CyanogenMod 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 org.cyanogenmod.internal;
+
+import android.app.Dialog;
+import android.app.IActivityManager;
+import android.content.Context;
+import android.content.pm.ActivityInfo;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.content.res.Resources;
+import android.view.KeyEvent;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+import android.view.accessibility.AccessibilityEvent;
+import android.widget.ImageView;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+
+import org.cyanogenmod.platform.internal.R;
+
+/**
+ * @hide
+ */
+public class BootDexoptDialog extends Dialog {
+ private final boolean mHideAppDetails;
+
+ private final ImageView mAppIcon;
+ private final TextView mMessage;
+ private final TextView mDetailMsg;
+ private final ProgressBar mProgress;
+
+ public static BootDexoptDialog create(Context context) {
+ return create(context, WindowManager.LayoutParams.TYPE_BOOT_PROGRESS);
+ }
+
+ public static BootDexoptDialog create(Context context, int windowType) {
+ final PackageManager pm = context.getPackageManager();
+ final int theme;
+ if (pm.hasSystemFeature(PackageManager.FEATURE_TELEVISION)
+ || pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK)) {
+ theme = com.android.internal.R.style.Theme_Micro_Dialog_Alert;
+ } else if (pm.hasSystemFeature(PackageManager.FEATURE_WATCH)) {
+ theme = com.android.internal.R.style.Theme_Leanback_Dialog_Alert;
+ } else {
+ theme = com.android.internal.R.style.Theme_Material_Light;
+ }
+
+ return new BootDexoptDialog(context, theme, windowType);
+ }
+
+ private BootDexoptDialog(Context context, int themeResId, int windowType) {
+ super(context, themeResId);
+ mHideAppDetails = context.getResources().getBoolean(
+ R.bool.config_bootDexoptHideAppDetails);
+
+ requestWindowFeature(Window.FEATURE_NO_TITLE);
+ if (windowType != 0) {
+ getWindow().setType(windowType);
+ }
+
+ setContentView(R.layout.dexopt_dialog);
+ mMessage = (TextView) findViewById(R.id.dexopt_message);
+ mDetailMsg = (TextView) findViewById(R.id.dexopt_message_detail);
+ mAppIcon = (ImageView) findViewById(R.id.dexopt_icon);
+ mProgress = (ProgressBar) findViewById(R.id.dexopt_progress);
+
+ getWindow().setLayout(
+ WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
+ | WindowManager.LayoutParams.FLAG_FULLSCREEN);
+
+ final WindowManager.LayoutParams lp = getWindow().getAttributes();
+ // turn off button lights when dexopting
+ lp.buttonBrightness = 0;
+ lp.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
+ getWindow().setAttributes(lp);
+ setCancelable(false);
+ show();
+
+ // start the marquee
+ mMessage.setSelected(true);
+ mDetailMsg.setSelected(true);
+ }
+
+ public void setProgress(final int stage, final ApplicationInfo optimizedApp,
+ final int currentAppPos, final int totalAppCount) {
+ if (totalAppCount > 0) {
+ mProgress.setMax(totalAppCount);
+ }
+
+ final Resources res = getContext().getResources();
+ final PackageManager pm = getContext().getPackageManager();
+
+ if (optimizedApp != null) {
+ if (mHideAppDetails) {
+ mMessage.setText(res.getString(R.string.android_preparing_apk_obscured));
+ mAppIcon.setImageResource(R.drawable.ic_dexopt_obscured);
+ } else {
+ final CharSequence label = optimizedApp.loadLabel(pm);
+ mMessage.setText(res.getString(R.string.android_preparing_apk, label));
+ mAppIcon.setImageDrawable(optimizedApp.loadIcon(pm));
+ }
+ mDetailMsg.setText(res.getString(
+ R.string.android_upgrading_apk, currentAppPos, totalAppCount));
+ mProgress.setProgress(currentAppPos);
+ mProgress.setVisibility(View.VISIBLE);
+ } else {
+ mMessage.setText(res.getString(R.string.android_upgrading_complete));
+ mAppIcon.setImageResource(R.drawable.ic_dexopt_starting);
+ mProgress.setVisibility(View.INVISIBLE);
+
+ if (stage == IActivityManager.BOOT_STAGE_STARTING_APPS) {
+ mDetailMsg.setText(res.getString(R.string.android_upgrading_starting_apps));
+ } else if (stage == IActivityManager.BOOT_STAGE_FSTRIM) {
+ mDetailMsg.setText(res.getString(R.string.android_upgrading_fstrim));
+ } else if (stage == IActivityManager.BOOT_STAGE_COMPLETE) {
+ mDetailMsg.setText(res.getString(R.string.android_upgrading_complete_details));
+ } else {
+ mDetailMsg.setText(null);
+ }
+ }
+ }
+
+ // This dialog will consume all events coming in to
+ // it, to avoid it trying to do things too early in boot.
+
+ @Override
+ public boolean dispatchKeyEvent(KeyEvent event) {
+ return true;
+ }
+
+ @Override
+ public boolean dispatchKeyShortcutEvent(KeyEvent event) {
+ return true;
+ }
+
+ @Override
+ public boolean dispatchTouchEvent(MotionEvent ev) {
+ return true;
+ }
+
+ @Override
+ public boolean dispatchTrackballEvent(MotionEvent ev) {
+ return true;
+ }
+
+ @Override
+ public boolean dispatchGenericMotionEvent(MotionEvent ev) {
+ return true;
+ }
+
+ @Override
+ public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
+ return true;
+ }
+}
diff --git a/system-api/cm_system-current.txt b/system-api/cm_system-current.txt
index a93f52f..5a57e67 100644
--- a/system-api/cm_system-current.txt
+++ b/system-api/cm_system-current.txt
@@ -742,14 +742,30 @@ package cyanogenmod.platform {
ctor public R.bool();
}
+ public static final class R.color {
+ ctor public R.color();
+ }
+
+ public static final class R.dimen {
+ ctor public R.dimen();
+ }
+
public static final class R.drawable {
ctor public R.drawable();
}
+ public static final class R.id {
+ ctor public R.id();
+ }
+
public static final class R.integer {
ctor public R.integer();
}
+ public static final class R.layout {
+ ctor public R.layout();
+ }
+
public static final class R.string {
ctor public R.string();
}