You are now a developer!

* Show alternative brand logo in dexopt screen
  when developer options are enabled
* Drawable by Asher

Change-Id: Ie100d7c3e9c96a7ad64c4cd65195d6f531090140
This commit is contained in:
Michael Bestas 2016-08-18 20:55:10 +03:00
parent c349280cf8
commit 2059ea6908
No known key found for this signature in database
GPG Key ID: 913E2F936DD5E2D7
4 changed files with 47 additions and 2 deletions

View File

@ -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="96dp"
android:height="90dp"
android:viewportWidth="96"
android:viewportHeight="90">
<path
android:fillColor="@color/dexopt_logo"
android:pathData="M96,38.58V67.64c0,16.8-16.21,21.74-45.22,22H43.6v0c-28-.46-43.6-5.52-43.6-22V38.58c0-9,4.64-14.55,13.37-17.86L6.79,4.65A3.14,3.14,0,1,1,12.6,2.27l6.82,16.65c6.54-1.5,14.64-2.19,24.18-2.35h0c1.43,0,2.89,0,4.39,0v0h0v0c11.47,0,21.06
.66
,28.58,2.38L83.4,2.27a3.14,3.14,0,1,1,5.81,2.38L82.63,20.72C91.36,24,96,29.61,96,38.58ZM42.47,73.13c0,.08,0,.16,0,.24a4,4,0,0,0,4,4h3a4,4,0,0,0,4-4c0-.08,0-.16,0-.24ZM10,50.68a14.36,14.36,0,1,0,28.35,1L11.45,46.54A14.36,14.36,0,0,0,10,50.68Zm74.59-4.15L57.69,51.72a14.36,14.36,0,1,0,26.86-5.18Z" />
</vector>

View File

@ -29,6 +29,7 @@
android:elevation="8dp">
<ImageView
android:id="@+id/dexopt_logo_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingTop="@dimen/dexopt_bottom_height"

View File

@ -132,6 +132,7 @@
<!-- Boot dexopt dialog -->
<java-symbol type="bool" name="config_bootDexoptHideAppDetails" />
<java-symbol type="drawable" name="dexopt_brand_logo" />
<java-symbol type="drawable" name="dexopt_brand_logo_alternative" />
<java-symbol type="drawable" name="ic_device_bg" />
<java-symbol type="drawable" name="ic_device" />
<java-symbol type="drawable" name="ic_dexopt_obscured" />
@ -140,6 +141,7 @@
<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_logo_view" />
<java-symbol type="id" name="dexopt_message" />
<java-symbol type="id" name="dexopt_message_detail" />
<java-symbol type="id" name="dexopt_progress" />

View File

@ -18,11 +18,13 @@ package org.cyanogenmod.internal;
import android.app.Dialog;
import android.app.IActivityManager;
import android.content.ContentResolver;
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.provider.Settings;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
@ -52,7 +54,14 @@ public class BootDexoptDialog extends Dialog {
public static BootDexoptDialog create(Context context, int windowType) {
final PackageManager pm = context.getPackageManager();
final int brandLogo;
final int theme;
if (Settings.Global.getInt(context.getContentResolver(),
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED , 0) == 1) {
brandLogo = R.drawable.dexopt_brand_logo_alternative;
} else {
brandLogo = R.drawable.dexopt_brand_logo;
}
if (pm.hasSystemFeature(PackageManager.FEATURE_TELEVISION)
|| pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK)) {
theme = com.android.internal.R.style.Theme_Micro_Dialog_Alert;
@ -62,10 +71,11 @@ public class BootDexoptDialog extends Dialog {
theme = com.android.internal.R.style.Theme_Material_Light;
}
return new BootDexoptDialog(context, theme, windowType);
return new BootDexoptDialog(context, theme, windowType, brandLogo);
}
private BootDexoptDialog(Context context, int themeResId, int windowType) {
private BootDexoptDialog(Context context, int themeResId, int windowType,
int brandLogoResId) {
super(context, themeResId);
mHideAppDetails = context.getResources().getBoolean(
R.bool.config_bootDexoptHideAppDetails);
@ -76,6 +86,10 @@ public class BootDexoptDialog extends Dialog {
}
setContentView(R.layout.dexopt_dialog);
final ImageView brandLogo = (ImageView) findViewById(R.id.dexopt_logo_view);
brandLogo.setImageResource(brandLogoResId);
mMessage = (TextView) findViewById(R.id.dexopt_message);
mDetailMsg = (TextView) findViewById(R.id.dexopt_message_detail);
mAppIcon = (ImageView) findViewById(R.id.dexopt_icon);