Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mm6.0 #30

Open
wants to merge 14 commits into
base: mm6.0
Choose a base branch
from
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion core/java/android/app/ActivityThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -4444,7 +4444,7 @@ private void updateDefaultDensity() {
+ DisplayMetrics.DENSITY_DEVICE + " to "
+ mCurDefaultDisplayDpi);
DisplayMetrics.DENSITY_DEVICE = mCurDefaultDisplayDpi;
Bitmap.setDefaultDensity(DisplayMetrics.DENSITY_DEFAULT);
Bitmap.setDefaultDensity(DisplayMetrics.DENSITY_DEVICE);
}
}

Expand Down
11 changes: 8 additions & 3 deletions core/java/android/content/res/Resources.java
Original file line number Diff line number Diff line change
Expand Up @@ -1968,8 +1968,13 @@ public void updateConfiguration(Configuration config,
mConfiguration.setLayoutDirection(mConfiguration.locale);
}
if (mConfiguration.densityDpi != Configuration.DENSITY_DPI_UNDEFINED) {
mMetrics.densityDpi = mConfiguration.densityDpi;
mMetrics.density = mConfiguration.densityDpi * DisplayMetrics.DENSITY_DEFAULT_SCALE;
if (DisplayMetrics.DENSITY_DEVICE_DEFAULT == mCompatibilityInfo.applicationDensity
&& (config != null
&& config.densityDpi == DisplayMetrics.DENSITY_DEVICE_DEFAULT)) {
mMetrics.setDensity(DisplayMetrics.DENSITY_PREFERRED);
} else {
mMetrics.setDensity(mConfiguration.densityDpi);
}
}
mMetrics.scaledDensity = mMetrics.density * mConfiguration.fontScale;

Expand Down Expand Up @@ -2391,7 +2396,7 @@ public final void startPreloading() {
}
sPreloaded = true;
mPreloading = true;
sPreloadedDensity = DisplayMetrics.DENSITY_DEVICE;
sPreloadedDensity = DisplayMetrics.DENSITY_PREFERRED;
mConfiguration.densityDpi = sPreloadedDensity;
updateConfiguration(null, null);
}
Expand Down
10 changes: 9 additions & 1 deletion core/java/android/preference/Preference.java
Original file line number Diff line number Diff line change
Expand Up @@ -1377,10 +1377,18 @@ public void setDefaultValue(Object defaultValue) {
mDefaultValue = defaultValue;
}

/**
* Returns whether the preference can be found in persistent storage
* @hide
*/
protected boolean isPersisted() {
return getSharedPreferences().contains(mKey);
}

private void dispatchSetInitialValue() {
// By now, we know if we are persistent.
final boolean shouldPersist = shouldPersist();
if (!shouldPersist || !getSharedPreferences().contains(mKey)) {
if (!shouldPersist || !isPersisted()) {
if (mDefaultValue != null) {
onSetInitialValue(false, mDefaultValue);
}
Expand Down
43 changes: 33 additions & 10 deletions core/java/android/util/DisplayMetrics.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package android.util;

import android.graphics.Bitmap;
import android.os.SystemProperties;


Expand Down Expand Up @@ -138,7 +139,20 @@ public class DisplayMetrics {
* density for a display in {@link #densityDpi}.
*/
@Deprecated
public static int DENSITY_DEVICE = getDeviceDensity();
public static int DENSITY_DEVICE;

/** @hide */
public static int DENSITY_PREFERRED;

/** @hide */
public static int DENSITY_DEVICE_DEFAULT;

static {
DENSITY_DEVICE = SystemProperties.getInt("qemu.sf.lcd_density", SystemProperties
.getInt("ro.sf.lcd_density", DENSITY_DEFAULT));
DENSITY_DEVICE_DEFAULT = DENSITY_DEVICE;
DENSITY_PREFERRED = SystemProperties.getInt("persist.sys.lcd_density", DENSITY_DEVICE);
}

/**
* The absolute width of the display in pixels.
Expand Down Expand Up @@ -229,6 +243,24 @@ public class DisplayMetrics {
*/
public float noncompatYdpi;

/** @hide */
public void setDensity(int inDensity) {
density = inDensity / (float) DENSITY_DEFAULT;
densityDpi = inDensity;
scaledDensity = density;
xdpi = inDensity;
ydpi = inDensity;

noncompatDensity = density;
noncompatDensityDpi = densityDpi;
noncompatScaledDensity = scaledDensity;
noncompatXdpi = xdpi;
noncompatYdpi = ydpi;

DENSITY_DEVICE = inDensity;
Bitmap.setDefaultDensity(inDensity);
}

public DisplayMetrics() {
}

Expand Down Expand Up @@ -319,13 +351,4 @@ public String toString() {
", height=" + heightPixels + ", scaledDensity=" + scaledDensity +
", xdpi=" + xdpi + ", ydpi=" + ydpi + "}";
}

private static int getDeviceDensity() {
// qemu.sf.lcd_density can be used to override ro.sf.lcd_density
// when running in the emulator, allowing for dynamic configurations.
// The reason for this is that ro.sf.lcd_density is write-once and is
// set by the init process when it parses build.prop before anything else.
return SystemProperties.getInt("qemu.sf.lcd_density",
SystemProperties.getInt("ro.sf.lcd_density", DENSITY_DEFAULT));
}
}
92 changes: 0 additions & 92 deletions core/java/android/util/NativeTextHelper.java

This file was deleted.

3 changes: 3 additions & 0 deletions core/java/android/view/Display.java
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,9 @@ public void getMetrics(DisplayMetrics outMetrics) {
synchronized (this) {
updateDisplayInfoLocked();
mDisplayInfo.getAppMetrics(outMetrics, mDisplayAdjustments);
if (getDisplayId() == DEFAULT_DISPLAY) {
outMetrics.densityDpi = DisplayMetrics.DENSITY_DEVICE_DEFAULT;
}
}
}

Expand Down
5 changes: 5 additions & 0 deletions core/java/android/view/DisplayInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,11 @@ private void getMetricsWithSize(DisplayMetrics outMetrics, CompatibilityInfo com

if (!compatInfo.equals(CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO)) {
compatInfo.applyToDisplayMetrics(outMetrics);
} else if (type == Display.TYPE_BUILT_IN
&& (flags & Display.FLAG_PRESENTATION) == 0) {
outMetrics.setDensity(DisplayMetrics.DENSITY_PREFERRED);
} else {
outMetrics.setDensity(logicalDensityDpi);
}
}

Expand Down
7 changes: 7 additions & 0 deletions core/java/android/view/IWindowManager.aidl
Original file line number Diff line number Diff line change
Expand Up @@ -271,4 +271,11 @@ interface IWindowManager
* @return The frame statistics or null if the window does not exist.
*/
WindowContentFrameStats getWindowContentFrameStats(IBinder token);

/**
* Toggle global menu
*
* @hide
*/
void toggleGlobalMenu();
}
7 changes: 7 additions & 0 deletions core/java/android/view/WindowManagerPolicy.java
Original file line number Diff line number Diff line change
Expand Up @@ -1311,4 +1311,11 @@ public boolean rotationHasCompatibleMetricsLw(@ActivityInfo.ScreenOrientation in
* @param fadeoutDuration the duration of the exit animation, in milliseconds
*/
public void startKeyguardExitAnimation(long startTime, long fadeoutDuration);

/**
* Toggle global menu
*
* @hide
*/
public void toggleGlobalMenu();
}
13 changes: 13 additions & 0 deletions core/java/android/widget/Toast.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
import android.app.INotificationManager;
import android.app.ITransientNotification;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.PixelFormat;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.RemoteException;
import android.os.ServiceManager;
Expand Down Expand Up @@ -400,6 +402,17 @@ public void handleShow() {
if (context == null) {
context = mView.getContext();
}

ImageView appIcon = (ImageView) mView.findViewById(android.R.id.icon);
if (appIcon != null) {
PackageManager pm = context.getPackageManager();
try {
Drawable icon = pm.getApplicationIcon(packageName);
appIcon.setImageDrawable(icon);
} catch (PackageManager.NameNotFoundException e) {
// Empty
}
}
mWM = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
// We can resolve the Gravity here by using the Locale for getting
// the layout direction
Expand Down
9 changes: 9 additions & 0 deletions core/java/com/android/internal/statusbar/IStatusBar.aidl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.android.internal.statusbar;

import android.content.Intent;
import android.os.Bundle;
import android.service.notification.StatusBarNotification;

Expand Down Expand Up @@ -76,5 +77,13 @@ oneway interface IStatusBar
* @param source the identifier for the gesture, see {@link StatusBarManager}
*/
void onCameraLaunchGestureDetected(int source);

/**
* SlimActions additions
*/
void showCustomIntentAfterKeyguard(inout Intent intent);
void toggleScreenshot();
void toggleLastApp();
void toggleKillApp();
}

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.android.internal.statusbar;

import android.content.Intent;
import android.os.Bundle;
import android.service.notification.StatusBarNotification;

Expand Down Expand Up @@ -90,4 +91,12 @@ interface IStatusBarService
void appTransitionStarting(long statusBarAnimationsStartTime, long statusBarAnimationsDuration);

void startAssist(in Bundle args);

/**
* SlimActions additions
*/
void showCustomIntentAfterKeyguard(inout Intent intent);
void toggleScreenshot();
void toggleLastApp();
void toggleKillApp();
}
19 changes: 15 additions & 4 deletions core/res/res/layout/transient_notification.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,35 @@
*/
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="?android:attr/toastFrameBackground">
android:clipChildren="false">

<TextView
android:id="@android:id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-16dp"
android:layout_marginStart="-16dp"
android:layout_toRightOf="@android:id/icon"
android:layout_below="@android:id/icon"
android:textAppearance="@style/TextAppearance.Toast"
android:textColor="@color/bright_foreground_dark"
android:shadowColor="#BB000000"
android:shadowRadius="2.75"
android:background="?android:attr/toastFrameBackground"
/>

</LinearLayout>
<ImageView
android:id="@android:id/icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"/>

</RelativeLayout>


4 changes: 0 additions & 4 deletions core/res/res/values-zh-rHK/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1517,8 +1517,4 @@
<item quantity="other">已選取 <xliff:g id="COUNT_1">%1$d</xliff:g> 個項目</item>
<item quantity="one">已選取 <xliff:g id="COUNT_0">%1$d</xliff:g> 個項目</item>
</plurals>
<!-- Carrier Name -->
<string name="China_Mobile">中國移動</string>
<string name="China_Unicom">中國聯通</string>
<string name="China_Telecom">中國電信</string>
</resources>
Loading