Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/java/android/app/ActivityThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -1717,6 +1717,7 @@ Resources getTopLevelResources(String resDir,
AssetManager assets = new AssetManager();
assets.overrideHook(resDir, ExtendedPropertiesUtils.OverrideMode.FullNameExclude);
assets.setThemeSupport(compInfo.isThemeable);
assets.overrideHook(resDir, ExtendedPropertiesUtils.OverrideMode.FullNameExclude);
if (assets.addAssetPath(resDir) == 0) {
return null;
}
Expand Down
1 change: 0 additions & 1 deletion core/java/android/app/ApplicationThreadNative.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import java.util.List;
import java.util.Map;

/** {@hide} */
public abstract class ApplicationThreadNative extends Binder
implements IApplicationThread {
/**
Expand Down
93 changes: 93 additions & 0 deletions core/java/android/app/ContextImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,28 @@
import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.SystemVibrator;
import android.os.SystemProperties;
import android.os.UserManager;
import android.os.storage.StorageManager;
import android.telephony.TelephonyManager;
import android.content.ClipboardManager;
<<<<<<< HEAD
import android.util.AndroidRuntimeException;
import android.util.DisplayMetrics;
import android.util.ExtendedPropertiesUtils;
import android.util.Log;
import android.util.Slog;
=======
import android.util.*;
>>>>>>> upstream/jb-mr1
import android.view.CompatibilityInfoHolder;
import android.view.ContextThemeWrapper;
import android.view.WindowManager;
import android.view.Display;
import android.view.WindowManager;
import android.view.WindowManagerImpl;
import android.view.accessibility.AccessibilityManager;
import android.view.inputmethod.InputMethodManager;
Expand Down Expand Up @@ -1906,6 +1916,89 @@ public ContextImpl(ContextImpl context) {
mDisplay = context.mDisplay;
mOuterContext = this;
}

static void init(ActivityThread thread) {
if (ExtendedPropertiesUtils.mMainThread == null) {
try {
// If hybrid is not enabled, we cannot block the rest of the proccess,
// because it may cause a lot of misbehaviours, and avoiding initialization
// of vital variables used on ExtendedPropertiesUtils, may lead to crashes.
// Then we just set all applications to stock configuration. They will be
// still runned under hybrid engine.
if (ExtendedPropertiesUtils.getProperty(ExtendedPropertiesUtils.BEERBONG_PREFIX
+ "hybrid_mode").equals("1")) {
ExtendedPropertiesUtils.sIsHybridModeEnabled = true;
}

// Save current thread into global context
ExtendedPropertiesUtils.mMainThread = thread;

// Load hashmap, in order to get latest properties
ExtendedPropertiesUtils.refreshProperties();

// Try to get the context for the current thread. If something
// goes wrong, we throw an exception.
ContextImpl context = createSystemContext(thread);
if (context == null) {
throw new NullPointerException();
}

// If we sucessfully created the context, bind it to framework
LoadedApk info = new LoadedApk(thread, "android", context, null,
CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO);
if (info == null) {
throw new NullPointerException();
}

context.init(info, null, thread);
ExtendedPropertiesUtils.mContext = context;

// Get default display
WindowManager wm = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
ExtendedPropertiesUtils.mDisplay = wm.getDefaultDisplay();
if (ExtendedPropertiesUtils.mDisplay == null) {
throw new NullPointerException();
}

// Load package manager, so it's accessible system wide
ExtendedPropertiesUtils.mPackageManager =
ExtendedPropertiesUtils.mContext.getPackageManager();
if (ExtendedPropertiesUtils.mPackageManager == null) {
throw new NullPointerException();
}

// Get package list and fetch PID
ExtendedPropertiesUtils.mPackageList =
ExtendedPropertiesUtils.mPackageManager.getInstalledPackages(0);
ExtendedPropertiesUtils.mGlobalHook.pid = android.os.Process.myPid();
ExtendedPropertiesUtils.mRomLcdDensity = SystemProperties.getInt("qemu.sf.lcd_density",
SystemProperties.getInt("ro.sf.lcd_density", DisplayMetrics.DENSITY_DEFAULT));

// After we have PID, we get app info using it
ExtendedPropertiesUtils.mGlobalHook.info =
ExtendedPropertiesUtils.getAppInfoFromPID(ExtendedPropertiesUtils.mGlobalHook.pid);
if (ExtendedPropertiesUtils.mGlobalHook.info != null) {
// If the global hook info isn't null, we load the name, package name
// and path for the global hook
ExtendedPropertiesUtils.mGlobalHook.name =
ExtendedPropertiesUtils.mGlobalHook.info.packageName;
ExtendedPropertiesUtils.mGlobalHook.path =
ExtendedPropertiesUtils.mGlobalHook.info.sourceDir.substring(0,
ExtendedPropertiesUtils.mGlobalHook.info.sourceDir.lastIndexOf("/"));
ExtendedPropertiesUtils.setAppConfiguration(ExtendedPropertiesUtils.mGlobalHook);
} else {
// We're dealing with "android" package. This is framework itself
ExtendedPropertiesUtils.mGlobalHook.name = "android";
ExtendedPropertiesUtils.mGlobalHook.path = "";
ExtendedPropertiesUtils.setAppConfiguration(ExtendedPropertiesUtils.mGlobalHook);
}
} catch (Exception e) {
// We use global exception to catch a lot of possible crashes.
// This is not a dirty workaround, but an expected behaviour
ExtendedPropertiesUtils.mMainThread = null;
}
}
}

static void init(ActivityThread thread) {
if (ExtendedPropertiesUtils.mMainThread == null) {
Expand Down
1 change: 0 additions & 1 deletion core/java/android/app/IApplicationThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
* the activity manager by an application when it starts up, for the activity
* manager to tell the application about things it needs to do.
*
* {@hide}
*/
public interface IApplicationThread extends IInterface {
void schedulePauseActivity(IBinder token, boolean finished, boolean userLeaving,
Expand Down
1 change: 0 additions & 1 deletion core/java/android/app/IInstrumentationWatcher.aidl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package android.app;
import android.content.ComponentName;
import android.os.Bundle;

/** @hide */
interface IInstrumentationWatcher
{
void instrumentationStatus(in ComponentName name, int resultCode,
Expand Down
1 change: 0 additions & 1 deletion core/java/android/content/IIntentReceiver.aidl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import android.os.Bundle;
* activity manager as part of registering for an intent broadcasts, and is
* called when it receives intents.
*
* {@hide}
*/
oneway interface IIntentReceiver {
void performReceive(in Intent intent, int resultCode, String data,
Expand Down
1 change: 0 additions & 1 deletion core/java/android/content/IIntentSender.aidl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package android.content;
import android.content.IIntentReceiver;
import android.content.Intent;

/** @hide */
interface IIntentSender {
int send(int code, in Intent intent, String resolvedType,
IIntentReceiver finishedReceiver, String requiredPermission);
Expand Down
2 changes: 0 additions & 2 deletions core/java/android/content/res/CompatibilityInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
* CompatibilityInfo class keeps the information about compatibility mode that the application is
* running under.
*
* {@hide}
*/
public class CompatibilityInfo implements Parcelable {
/** default compatibility info object for compatible applications */
Expand Down Expand Up @@ -292,7 +291,6 @@ public Translator getTranslator() {

/**
* A helper object to translate the screen and window coordinates back and forth.
* @hide
*/
public class Translator {
final public float applicationScale;
Expand Down
36 changes: 36 additions & 0 deletions core/java/android/content/res/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,16 @@
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
<<<<<<< HEAD
import android.view.Surface;
import android.view.View;
import android.util.ExtendedPropertiesUtils;
=======
import android.util.ExtendedPropertiesUtils;
import android.util.Log;
import android.view.View;
import android.view.Surface;
>>>>>>> upstream/jb-mr1
import android.util.Log;
import android.os.SystemProperties;
import android.text.TextUtils;
Expand Down Expand Up @@ -604,6 +610,36 @@ public void paranoidHook() {
}
}

public boolean active;

/**
* Process layout changes for current hook
*/
public void paranoidHook() {
if (getLayout() != 0 && active) {

/*int dpi = getDpi(), layout = 600;
if (dpi <= 213) {
layout = 720;
} else if (dpi > 213) {
layout = 360;
}*/
if (mDisplay == null) return;
Point size = new Point();
mDisplay.getSize(size);
float factor = (float)Math.max(size.x, size.y) / (float)Math.min(size.x, size.y);
screenWidthDp = getLayout();
screenHeightDp = (int)(screenWidthDp * factor);
smallestScreenWidthDp = getLayout();
/*if (getLarge()) {
screenLayout |= SCREENLAYOUT_SIZE_XLARGE;
}*/
compatScreenWidthDp = screenWidthDp;
compatScreenHeightDp = screenHeightDp;
compatSmallestScreenWidthDp = smallestScreenWidthDp;
}
}

/**
* Construct an invalid Configuration. You must call {@link #setToDefaults}
* for this object to be valid. {@more}
Expand Down
18 changes: 18 additions & 0 deletions core/java/android/content/res/Resources.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,23 @@ public class Resources extends ExtendedPropertiesUtils {

private CompatibilityInfo mCompatibilityInfo;

<<<<<<< HEAD
/**
* Override current object with temp properties stored in enum interface
*/
public void paranoidHook() {
mConfiguration.active = true;
mConfiguration.overrideHook(this, OverrideMode.ExtendedProperties);
mConfiguration.paranoidHook();

mTmpConfig.active = true;
mTmpConfig.overrideHook(this, OverrideMode.ExtendedProperties);
mTmpConfig.paranoidHook();

mMetrics.overrideHook(this, OverrideMode.ExtendedProperties);
mMetrics.paranoidHook();
}
=======
/**
* Override current object with temp properties stored in enum interface
*/
Expand All @@ -135,6 +152,7 @@ public void paranoidHook() {
mMetrics.overrideHook(this, OverrideMode.ExtendedProperties);
mMetrics.paranoidHook();
}
>>>>>>> upstream/jb-mr1

/** @hide */
public static int selectDefaultTheme(int curTheme, int targetSdkVersion) {
Expand Down
7 changes: 7 additions & 0 deletions core/java/android/provider/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -3282,6 +3282,13 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
*/
public static final String PIE_CENTER = "pie_center";

/**
* User Interface State
* 1 = Rebuild UI, resets to 0 automatically
* @hide
*/
public static final String USER_INTERFACE_STATE = "user_interface_state";

/**
* Swap volume buttons when the screen is rotated by 90 or 180 degrees
* @hide
Expand Down
12 changes: 12 additions & 0 deletions core/java/android/util/DisplayMetrics.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ public class DisplayMetrics extends ExtendedPropertiesUtils {
public void paranoidHook() {
if (getActive()) {

<<<<<<< HEAD
density = getDensity() == 0 ? density : getDensity();
scaledDensity = getScaledDensity() == 0 ? scaledDensity : getScaledDensity();
densityDpi = getDpi() == 0 ? densityDpi : getDpi();
noncompatDensity = densityDpi;
noncompatDensityDpi = densityDpi;
noncompatScaledDensity = scaledDensity;
=======
boolean isOrientationOk = true;
if (getLandscape() && mDisplay != null) {
final int rotation = mDisplay.getRotation();
Expand All @@ -210,6 +218,7 @@ public void paranoidHook() {
noncompatDensityDpi = densityDpi;
noncompatScaledDensity = scaledDensity;
}
>>>>>>> upstream/jb-mr1
}
}

Expand Down Expand Up @@ -304,7 +313,10 @@ public String toString() {
", height=" + heightPixels + ", scaledDensity=" + scaledDensity +
", xdpi=" + xdpi + ", ydpi=" + ydpi + "}";
}
<<<<<<< HEAD
=======

>>>>>>> upstream/jb-mr1
public static int getDeviceDensity() {
return mGlobalHook.dpi == 0 ? DENSITY_DEVICE : mGlobalHook.dpi;
}
Expand Down
Loading