diff options
Diffstat (limited to 'tools')
15 files changed, 329 insertions, 127 deletions
diff --git a/tools/aapt/AaptAssets.cpp b/tools/aapt/AaptAssets.cpp index 46b8a27..5b71adc 100644 --- a/tools/aapt/AaptAssets.cpp +++ b/tools/aapt/AaptAssets.cpp @@ -183,6 +183,13 @@ AaptGroupEntry::parseNamePart(const String8& part, int* axis, uint32_t* value) return 0; } + // layout direction + if (getLayoutDirectionName(part.string(), &config)) { + *axis = AXIS_LAYOUTDIR; + *value = (config.screenLayout&ResTable_config::MASK_LAYOUTDIR); + return 0; + } + // smallest screen dp width if (getSmallestScreenWidthDpName(part.string(), &config)) { *axis = AXIS_SMALLESTSCREENWIDTHDP; @@ -309,6 +316,8 @@ AaptGroupEntry::getConfigValueForAxis(const ResTable_config& config, int axis) case AXIS_LANGUAGE: return (((uint32_t)config.country[1]) << 24) | (((uint32_t)config.country[0]) << 16) | (((uint32_t)config.language[1]) << 8) | (config.language[0]); + case AXIS_LAYOUTDIR: + return config.screenLayout&ResTable_config::MASK_LAYOUTDIR; case AXIS_SCREENLAYOUTSIZE: return config.screenLayout&ResTable_config::MASK_SCREENSIZE; case AXIS_ORIENTATION: @@ -364,7 +373,7 @@ AaptGroupEntry::initFromDirName(const char* dir, String8* resType) Vector<String8> parts; String8 mcc, mnc, loc, layoutsize, layoutlong, orient, den; - String8 touch, key, keysHidden, nav, navHidden, size, vers; + String8 touch, key, keysHidden, nav, navHidden, size, layoutDir, vers; String8 uiModeType, uiModeNight, smallestwidthdp, widthdp, heightdp; const char *p = dir; @@ -452,6 +461,18 @@ AaptGroupEntry::initFromDirName(const char* dir, String8* resType) //printf("not region: %s\n", part.string()); } + if (getLayoutDirectionName(part.string())) { + layoutDir = part; + + index++; + if (index == N) { + goto success; + } + part = parts[index]; + } else { + //printf("not layout direction: %s\n", part.string()); + } + if (getSmallestScreenWidthDpName(part.string())) { smallestwidthdp = part; @@ -674,6 +695,7 @@ success: this->navHidden = navHidden; this->navigation = nav; this->screenSize = size; + this->layoutDirection = layoutDir; this->version = vers; // what is this anyway? @@ -691,6 +713,8 @@ AaptGroupEntry::toString() const s += ","; s += this->locale; s += ","; + s += layoutDirection; + s += ","; s += smallestScreenWidthDp; s += ","; s += screenWidthDp; @@ -747,6 +771,12 @@ AaptGroupEntry::toDirName(const String8& resType) const } s += locale; } + if (this->layoutDirection != "") { + if (s.length() > 0) { + s += "-"; + } + s += layoutDirection; + } if (this->smallestScreenWidthDp != "") { if (s.length() > 0) { s += "-"; @@ -958,6 +988,28 @@ bool AaptGroupEntry::getLocaleName(const char* fileName, return false; } +bool AaptGroupEntry::getLayoutDirectionName(const char* name, ResTable_config* out) +{ + if (strcmp(name, kWildcardName) == 0) { + if (out) out->screenLayout = + (out->screenLayout&~ResTable_config::MASK_LAYOUTDIR) + | ResTable_config::LAYOUTDIR_ANY; + return true; + } else if (strcmp(name, "ldltr") == 0) { + if (out) out->screenLayout = + (out->screenLayout&~ResTable_config::MASK_LAYOUTDIR) + | ResTable_config::LAYOUTDIR_LTR; + return true; + } else if (strcmp(name, "ldrtl") == 0) { + if (out) out->screenLayout = + (out->screenLayout&~ResTable_config::MASK_LAYOUTDIR) + | ResTable_config::LAYOUTDIR_RTL; + return true; + } + + return false; +} + bool AaptGroupEntry::getScreenLayoutSizeName(const char* name, ResTable_config* out) { @@ -1415,6 +1467,7 @@ int AaptGroupEntry::compare(const AaptGroupEntry& o) const int v = mcc.compare(o.mcc); if (v == 0) v = mnc.compare(o.mnc); if (v == 0) v = locale.compare(o.locale); + if (v == 0) v = layoutDirection.compare(o.layoutDirection); if (v == 0) v = vendor.compare(o.vendor); if (v == 0) v = smallestScreenWidthDp.compare(o.smallestScreenWidthDp); if (v == 0) v = screenWidthDp.compare(o.screenWidthDp); @@ -1447,6 +1500,7 @@ const ResTable_config& AaptGroupEntry::toParams() const getMccName(mcc.string(), ¶ms); getMncName(mnc.string(), ¶ms); getLocaleName(locale.string(), ¶ms); + getLayoutDirectionName(layoutDirection.string(), ¶ms); getSmallestScreenWidthDpName(smallestScreenWidthDp.string(), ¶ms); getScreenWidthDpName(screenWidthDp.string(), ¶ms); getScreenHeightDpName(screenHeightDp.string(), ¶ms); diff --git a/tools/aapt/AaptAssets.h b/tools/aapt/AaptAssets.h index d5f296c..5cfa913 100644 --- a/tools/aapt/AaptAssets.h +++ b/tools/aapt/AaptAssets.h @@ -51,6 +51,7 @@ enum { AXIS_SMALLESTSCREENWIDTHDP, AXIS_SCREENWIDTHDP, AXIS_SCREENHEIGHTDP, + AXIS_LAYOUTDIR, AXIS_VERSION, AXIS_START = AXIS_MCC, @@ -95,6 +96,7 @@ public: static bool getSmallestScreenWidthDpName(const char* name, ResTable_config* out = NULL); static bool getScreenWidthDpName(const char* name, ResTable_config* out = NULL); static bool getScreenHeightDpName(const char* name, ResTable_config* out = NULL); + static bool getLayoutDirectionName(const char* name, ResTable_config* out = NULL); static bool getVersionName(const char* name, ResTable_config* out = NULL); int compare(const AaptGroupEntry& o) const; @@ -133,6 +135,7 @@ private: String8 navHidden; String8 navigation; String8 screenSize; + String8 layoutDirection; String8 version; mutable bool mParamsChanged; diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp index d98fe65..3d7b088 100644 --- a/tools/aapt/ResourceTable.cpp +++ b/tools/aapt/ResourceTable.cpp @@ -2811,7 +2811,7 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<AaptFile>& dest) NOISY(printf("Writing config %d config: imsi:%d/%d lang:%c%c cnt:%c%c " "orien:%d ui:%d touch:%d density:%d key:%d inp:%d nav:%d sz:%dx%d " - "sw%ddp w%ddp h%ddp\n", + "sw%ddp w%ddp h%ddp dir:%d\n", ti+1, config.mcc, config.mnc, config.language[0] ? config.language[0] : '-', @@ -2829,7 +2829,8 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<AaptFile>& dest) config.screenHeight, config.smallestScreenWidthDp, config.screenWidthDp, - config.screenHeightDp)); + config.screenHeightDp, + config.layoutDirection)); if (filterable && !filter.match(config)) { continue; @@ -2853,7 +2854,7 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<AaptFile>& dest) tHeader->config = config; NOISY(printf("Writing type %d config: imsi:%d/%d lang:%c%c cnt:%c%c " "orien:%d ui:%d touch:%d density:%d key:%d inp:%d nav:%d sz:%dx%d " - "sw%ddp w%ddp h%ddp\n", + "sw%ddp w%ddp h%ddp dir:%d\n", ti+1, tHeader->config.mcc, tHeader->config.mnc, tHeader->config.language[0] ? tHeader->config.language[0] : '-', @@ -2871,7 +2872,8 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<AaptFile>& dest) tHeader->config.screenHeight, tHeader->config.smallestScreenWidthDp, tHeader->config.screenWidthDp, - tHeader->config.screenHeightDp)); + tHeader->config.screenHeightDp, + tHeader->config.layoutDirection)); tHeader->config.swapHtoD(); // Build the entries inside of this type. @@ -3489,7 +3491,7 @@ sp<ResourceTable::Entry> ResourceTable::Type::getEntry(const String16& entry, if (config != NULL) { NOISY(printf("New entry at %s:%d: imsi:%d/%d lang:%c%c cnt:%c%c " "orien:%d touch:%d density:%d key:%d inp:%d nav:%d sz:%dx%d " - "sw%ddp w%ddp h%ddp\n", + "sw%ddp w%ddp h%ddp dir:%d\n", sourcePos.file.string(), sourcePos.line, config->mcc, config->mnc, config->language[0] ? config->language[0] : '-', @@ -3506,7 +3508,8 @@ sp<ResourceTable::Entry> ResourceTable::Type::getEntry(const String16& entry, config->screenHeight, config->smallestScreenWidthDp, config->screenWidthDp, - config->screenHeightDp)); + config->screenHeightDp, + config->layoutDirection)); } else { NOISY(printf("New entry at %s:%d: NULL config\n", sourcePos.file.string(), sourcePos.line)); diff --git a/tools/aidl/generate_java_rpc.cpp b/tools/aidl/generate_java_rpc.cpp index e5fa076..5e4dacc 100644 --- a/tools/aidl/generate_java_rpc.cpp +++ b/tools/aidl/generate_java_rpc.cpp @@ -786,7 +786,10 @@ generate_result_dispatcher_method(const method_type* method, } // Call the callback method - dispatchMethod->statements->Add(realCall); + IfStatement* ifst = new IfStatement; + ifst->expression = new Comparison(new FieldVariable(THIS_VALUE, "callback"), "!=", NULL_VALUE); + dispatchMethod->statements->Add(ifst); + ifst->statements->Add(realCall); } static void diff --git a/tools/layoutlib/bridge/.classpath b/tools/layoutlib/bridge/.classpath index a5db7b1..3c124d9 100644 --- a/tools/layoutlib/bridge/.classpath +++ b/tools/layoutlib/bridge/.classpath @@ -2,10 +2,10 @@ <classpath> <classpathentry excluding="org/kxml2/io/" kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="var" path="ANDROID_PLAT_SRC/prebuilt/common/layoutlib_api/layoutlib_api-prebuilt.jar"/> + <classpathentry kind="var" path="ANDROID_PLAT_SRC/prebuilts/misc/common/layoutlib_api/layoutlib_api-prebuilt.jar"/> <classpathentry kind="var" path="ANDROID_PLAT_SRC/prebuilts/misc/common/kxml2/kxml2-2.3.0.jar" sourcepath="/ANDROID_PLAT_SRC/dalvik/libcore/xml/src/main/java"/> <classpathentry kind="var" path="ANDROID_PLAT_SRC/out/host/common/obj/JAVA_LIBRARIES/temp_layoutlib_intermediates/javalib.jar" sourcepath="/ANDROID_PLAT_SRC/frameworks/base"/> - <classpathentry kind="var" path="ANDROID_PLAT_SRC/prebuilt/common/ninepatch/ninepatch-prebuilt.jar"/> - <classpathentry kind="var" path="ANDROID_PLAT_SRC/prebuilt/common/tools-common/tools-common-prebuilt.jar"/> + <classpathentry kind="var" path="ANDROID_PLAT_SRC/prebuilts/misc/common/ninepatch/ninepatch-prebuilt.jar"/> + <classpathentry kind="var" path="ANDROID_PLAT_SRC/prebuilts/misc/common/tools-common/tools-common-prebuilt.jar"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/tools/layoutlib/bridge/src/android/os/SystemClock_Delegate.java b/tools/layoutlib/bridge/src/android/os/SystemClock_Delegate.java index bd332a6..26cb97b 100644 --- a/tools/layoutlib/bridge/src/android/os/SystemClock_Delegate.java +++ b/tools/layoutlib/bridge/src/android/os/SystemClock_Delegate.java @@ -31,6 +31,7 @@ import com.android.tools.layoutlib.annotations.LayoutlibDelegate; */ public class SystemClock_Delegate { private static long sBootTime = System.currentTimeMillis(); + private static long sBootTimeNano = System.nanoTime(); @LayoutlibDelegate /*package*/ static boolean setCurrentTimeMillis(long millis) { @@ -60,6 +61,16 @@ public class SystemClock_Delegate { } /** + * Returns nanoseconds since boot, including time spent in sleep. + * + * @return elapsed nanoseconds since boot. + */ + @LayoutlibDelegate + /*package*/ static long elapsedRealtimeNano() { + return System.nanoTime() - sBootTimeNano; + } + + /** * Returns milliseconds running in the current thread. * * @return elapsed milliseconds in the thread diff --git a/tools/layoutlib/bridge/src/android/util/FloatMath_Delegate.java b/tools/layoutlib/bridge/src/android/util/FloatMath_Delegate.java index 1df78c2..8b4c60b 100644 --- a/tools/layoutlib/bridge/src/android/util/FloatMath_Delegate.java +++ b/tools/layoutlib/bridge/src/android/util/FloatMath_Delegate.java @@ -91,4 +91,42 @@ import com.android.tools.layoutlib.annotations.LayoutlibDelegate; /*package*/ static float sqrt(float value) { return (float)Math.sqrt(value); } + + /** + * Returns the closest float approximation of the raising "e" to the power + * of the argument. + * + * @param value to compute the exponential of + * @return the exponential of value + */ + @LayoutlibDelegate + /*package*/ static float exp(float value) { + return (float)Math.exp(value); + } + + /** + * Returns the closest float approximation of the result of raising {@code + * x} to the power of {@code y}. + * + * @param x the base of the operation. + * @param y the exponent of the operation. + * @return {@code x} to the power of {@code y}. + */ + @LayoutlibDelegate + /*package*/ static float pow(float x, float y) { + return (float)Math.pow(x, y); + } + + /** + * Returns {@code sqrt(}<i>{@code x}</i><sup>{@code 2}</sup>{@code +} <i> + * {@code y}</i><sup>{@code 2}</sup>{@code )}. + * + * @param x a float number + * @param y a float number + * @return the hypotenuse + */ + @LayoutlibDelegate + /*package*/ static float hypot(float x, float y) { + return (float)Math.sqrt(x*x + y*y); + } } diff --git a/tools/layoutlib/bridge/src/android/view/AttachInfo_Accessor.java b/tools/layoutlib/bridge/src/android/view/AttachInfo_Accessor.java index 97d9969..4901f72 100644 --- a/tools/layoutlib/bridge/src/android/view/AttachInfo_Accessor.java +++ b/tools/layoutlib/bridge/src/android/view/AttachInfo_Accessor.java @@ -19,6 +19,7 @@ package android.view; import com.android.layoutlib.bridge.android.BridgeWindow; import com.android.layoutlib.bridge.android.BridgeWindowSession; +import android.content.Context; import android.os.Handler; import android.view.View.AttachInfo; @@ -28,8 +29,12 @@ import android.view.View.AttachInfo; public class AttachInfo_Accessor { public static void setAttachInfo(View view) { + Context context = view.getContext(); + WindowManager wm = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE); + Display display = wm.getDefaultDisplay(); + ViewRootImpl root = new ViewRootImpl(context, display); AttachInfo info = new AttachInfo(new BridgeWindowSession(), new BridgeWindow(), - new ViewRootImpl(view.getContext()), new Handler(), null); + display, root, new Handler(), null); info.mHasWindowFocus = true; info.mWindowVisibility = View.VISIBLE; info.mInTouchMode = false; // this is so that we can display selections. diff --git a/tools/layoutlib/bridge/src/android/view/Display_Delegate.java b/tools/layoutlib/bridge/src/android/view/Display_Delegate.java index 8868c65..6ccdcb6 100644 --- a/tools/layoutlib/bridge/src/android/view/Display_Delegate.java +++ b/tools/layoutlib/bridge/src/android/view/Display_Delegate.java @@ -31,57 +31,4 @@ import android.os.RemoteException; */ public class Display_Delegate { - // ---- Overridden methods ---- - - @LayoutlibDelegate - public static IWindowManager getWindowManager() { - return RenderAction.getCurrentContext().getIWindowManager(); - } - - // ---- Native methods ---- - - @LayoutlibDelegate - /*package*/ static int getDisplayCount() { - return 1; - } - - @LayoutlibDelegate - /** @hide special for when we are faking the screen size. */ - /*package*/ static int getRawWidthNative(Display theDisplay) { - // same as real since we're not faking compatibility mode. - return RenderAction.getCurrentContext().getIWindowManager().getMetrics().widthPixels; - } - - @LayoutlibDelegate - /** @hide special for when we are faking the screen size. */ - /*package*/ static int getRawHeightNative(Display theDisplay) { - // same as real since we're not faking compatibility mode. - return RenderAction.getCurrentContext().getIWindowManager().getMetrics().heightPixels; - } - - @LayoutlibDelegate - /*package*/ static int getOrientation(Display theDisplay) { - try { - // always dynamically query for the current window manager - return getWindowManager().getRotation(); - } catch (RemoteException e) { - // this will never been thrown since this is not a true RPC. - } - - return Surface.ROTATION_0; - } - - @LayoutlibDelegate - /*package*/ static void nativeClassInit() { - // not needed for now. - } - - @LayoutlibDelegate - /*package*/ static void init(Display theDisplay, int display) { - // always dynamically query for the current window manager - BridgeWindowManager wm = RenderAction.getCurrentContext().getIWindowManager(); - theDisplay.mDensity = wm.getMetrics().density; - theDisplay.mDpiX = wm.getMetrics().xdpi; - theDisplay.mDpiY = wm.getMetrics().ydpi; - } } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java index 3ae660d..428c4c2 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java @@ -61,10 +61,13 @@ import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.os.PowerManager; +import android.os.UserHandle; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.util.TypedValue; import android.view.BridgeInflater; +import android.view.CompatibilityInfoHolder; +import android.view.Display; import android.view.Surface; import android.view.View; import android.view.ViewGroup; @@ -440,7 +443,7 @@ public final class BridgeContext extends Context { } if (POWER_SERVICE.equals(service)) { - return new PowerManager(new BridgePowerManager(), new Handler()); + return new PowerManager(this, new BridgePowerManager(), new Handler()); } throw new UnsupportedOperationException("Unsupported Service: " + service); @@ -917,6 +920,18 @@ public final class BridgeContext extends Context { } @Override + public Context createConfigurationContext(Configuration overrideConfiguration) { + // pass + return null; + } + + @Override + public Context createDisplayContext(Display display) { + // pass + return null; + } + + @Override public String[] databaseList() { // pass return null; @@ -1149,6 +1164,13 @@ public final class BridgeContext extends Context { } @Override + public Intent registerReceiverAsUser(BroadcastReceiver arg0, UserHandle arg0p5, + IntentFilter arg1, String arg2, Handler arg3) { + // pass + return null; + } + + @Override public void removeStickyBroadcast(Intent arg0) { // pass @@ -1187,6 +1209,24 @@ public final class BridgeContext extends Context { } @Override + public void sendBroadcastAsUser(Intent intent, UserHandle user) { + // pass + } + + @Override + public void sendBroadcastAsUser(Intent intent, UserHandle user, + String receiverPermission) { + // pass + } + + @Override + public void sendOrderedBroadcastAsUser(Intent intent, UserHandle user, + String receiverPermission, BroadcastReceiver resultReceiver, Handler scheduler, + int initialCode, String initialData, Bundle initialExtras) { + // pass + } + + @Override public void sendStickyBroadcast(Intent arg0) { // pass @@ -1200,6 +1240,24 @@ public final class BridgeContext extends Context { } @Override + public void sendStickyBroadcastAsUser(Intent intent, UserHandle user) { + // pass + } + + @Override + public void sendStickyOrderedBroadcastAsUser(Intent intent, + UserHandle user, BroadcastReceiver resultReceiver, + Handler scheduler, int initialCode, String initialData, + Bundle initialExtras) { + // pass + } + + @Override + public void removeStickyBroadcastAsUser(Intent intent, UserHandle user) { + // pass + } + + @Override public void setTheme(int arg0) { // pass @@ -1261,6 +1319,18 @@ public final class BridgeContext extends Context { } @Override + public ComponentName startServiceAsUser(Intent arg0, UserHandle arg1) { + // pass + return null; + } + + @Override + public boolean stopServiceAsUser(Intent arg0, UserHandle arg1) { + // pass + return false; + } + + @Override public void unbindService(ServiceConnection arg0) { // pass @@ -1299,4 +1369,10 @@ public final class BridgeContext extends Context { Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED, "OBB not supported", null); return null; } + + @Override + public CompatibilityInfoHolder getCompatibilityInfo(int displayId) { + // pass + return null; + } } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java index 6071a6b..0c85204 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java @@ -39,7 +39,7 @@ public class BridgePowerManager implements IPowerManager { } @Override - public void acquireWakeLock(int arg0, IBinder arg1, String arg2, WorkSource arg3) + public void acquireWakeLock(IBinder arg0, int arg1, String arg2, WorkSource arg3) throws RemoteException { // pass for now. } @@ -55,18 +55,7 @@ public class BridgePowerManager implements IPowerManager { } @Override - public int getSupportedWakeLockFlags() throws RemoteException { - // pass for now. - return 0; - } - - @Override - public void goToSleep(long arg0) throws RemoteException { - // pass for now. - } - - @Override - public void goToSleepWithReason(long arg0, int arg1) throws RemoteException { + public void goToSleep(long arg0, int arg1) throws RemoteException { // pass for now. } @@ -91,17 +80,17 @@ public class BridgePowerManager implements IPowerManager { } @Override - public void setAutoBrightnessAdjustment(float arg0) throws RemoteException { + public void setTemporaryScreenAutoBrightnessAdjustmentSettingOverride(float arg0) throws RemoteException { // pass for now. } @Override - public void setBacklightBrightness(int arg0) throws RemoteException { + public void setTemporaryScreenBrightnessSettingOverride(int arg0) throws RemoteException { // pass for now. } @Override - public void setMaximumScreenOffTimeount(int arg0) throws RemoteException { + public void setMaximumScreenOffTimeoutFromDeviceAdmin(int arg0) throws RemoteException { // pass for now. } @@ -121,12 +110,18 @@ public class BridgePowerManager implements IPowerManager { } @Override - public void userActivity(long arg0, boolean arg1) throws RemoteException { + public boolean isWakeLockLevelSupported(int level) throws RemoteException { + // pass for now. + return true; + } + + @Override + public void userActivity(long time, int event, int flags) throws RemoteException { // pass for now. } @Override - public void userActivityWithForce(long arg0, boolean arg1, boolean arg2) throws RemoteException { + public void wakeUp(long time) throws RemoteException { // pass for now. } } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java index 379fb81..fa660e6 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java @@ -47,12 +47,17 @@ public final class BridgeWindow implements IWindow { } @Override - public void resized(int arg0, int arg1, Rect arg2, Rect arg3, + public void resized(Rect arg1, Rect arg2, Rect arg3, boolean arg4, Configuration arg5) throws RemoteException { // pass for now. } @Override + public void moved(int arg0, int arg1) throws RemoteException { + // pass for now. + } + + @Override public void dispatchScreenState(boolean on) throws RemoteException { // pass for now. } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java index 8ab875f..b8d21f3 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java @@ -22,7 +22,6 @@ import com.android.internal.view.IInputMethodClient; import android.content.res.CompatibilityInfo; import android.content.res.Configuration; import android.graphics.Bitmap; -import android.graphics.Point; import android.os.IBinder; import android.os.IRemoteCallback; import android.os.RemoteException; @@ -31,15 +30,13 @@ import android.view.Display; import android.view.Display_Delegate; import android.view.Gravity; import android.view.IApplicationToken; +import android.view.IDisplayContentChangeListener; +import android.view.IInputFilter; import android.view.IOnKeyguardExitResult; import android.view.IRotationWatcher; import android.view.IWindowManager; import android.view.IWindowSession; -import android.view.InputChannel; -import android.view.InputDevice; -import android.view.InputEvent; -import android.view.KeyEvent; -import android.view.MotionEvent; +import android.view.WindowInfo; import java.util.List; @@ -72,23 +69,6 @@ public class BridgeWindowManager implements IWindowManager { return mRotation; } - @Override - public int getMaximumSizeDimension() throws RemoteException { - return 0; - } - - @Override - public void getCurrentSizeRange(Point smallestSize, Point largestSize) { - } - - @Override - public void getDisplaySize(Point arg0) throws RemoteException { - } - - @Override - public void getRealDisplaySize(Point arg0) throws RemoteException { - } - // ---- unused implementation of IWindowManager ---- @Override @@ -111,9 +91,13 @@ public class BridgeWindowManager implements IWindowManager { } @Override - public void clearForcedDisplaySize() throws RemoteException { + public void clearForcedDisplaySize(int displayId) throws RemoteException { // TODO Auto-generated method stub + } + @Override + public void clearForcedDisplayDensity(int displayId) throws RemoteException { + // TODO Auto-generated method stub } @Override @@ -123,6 +107,16 @@ public class BridgeWindowManager implements IWindowManager { } @Override + public void startFreezingScreen(int exitAnim, int enterAnim) { + // TODO Auto-generated method stub + } + + @Override + public void stopFreezingScreen() { + // TODO Auto-generated method stub + } + + @Override public void disableKeyguard(IBinder arg0, String arg1) throws RemoteException { // TODO Auto-generated method stub @@ -240,7 +234,7 @@ public class BridgeWindowManager implements IWindowManager { @Override public void overridePendingAppTransitionThumb(Bitmap srcThumb, int startX, int startY, - IRemoteCallback startedCallback, boolean delayed) throws RemoteException { + IRemoteCallback startedCallback, boolean scaleUp) throws RemoteException { // TODO Auto-generated method stub } @@ -281,7 +275,8 @@ public class BridgeWindowManager implements IWindowManager { } @Override - public Bitmap screenshotApplications(IBinder arg0, int arg1, int arg2) throws RemoteException { + public Bitmap screenshotApplications(IBinder arg0, int displayId, int arg1, int arg2) + throws RemoteException { // TODO Auto-generated method stub return null; } @@ -307,7 +302,6 @@ public class BridgeWindowManager implements IWindowManager { @Override public void setAppOrientation(IApplicationToken arg0, int arg1) throws RemoteException { // TODO Auto-generated method stub - } @Override @@ -315,7 +309,6 @@ public class BridgeWindowManager implements IWindowManager { CharSequence arg4, int arg5, int arg6, int arg7, IBinder arg8, boolean arg9) throws RemoteException { // TODO Auto-generated method stub - } @Override @@ -327,37 +320,36 @@ public class BridgeWindowManager implements IWindowManager { @Override public void setAppWillBeHidden(IBinder arg0) throws RemoteException { // TODO Auto-generated method stub - } @Override public void setEventDispatching(boolean arg0) throws RemoteException { // TODO Auto-generated method stub - } @Override public void setFocusedApp(IBinder arg0, boolean arg1) throws RemoteException { // TODO Auto-generated method stub - } @Override - public void setForcedDisplaySize(int arg0, int arg1) throws RemoteException { + public void setForcedDisplaySize(int displayId, int arg0, int arg1) throws RemoteException { // TODO Auto-generated method stub + } + @Override + public void setForcedDisplayDensity(int displayId, int density) throws RemoteException { + // TODO Auto-generated method stub } @Override public void setInTouchMode(boolean arg0) throws RemoteException { // TODO Auto-generated method stub - } @Override public void setNewConfiguration(Configuration arg0) throws RemoteException { // TODO Auto-generated method stub - } @Override @@ -368,19 +360,16 @@ public class BridgeWindowManager implements IWindowManager { @Override public void setStrictModeVisualIndicatorPreference(String arg0) throws RemoteException { // TODO Auto-generated method stub - } @Override public void showStrictModeViolation(boolean arg0) throws RemoteException { // TODO Auto-generated method stub - } @Override public void startAppFreezingScreen(IBinder arg0, int arg1) throws RemoteException { // TODO Auto-generated method stub - } @Override @@ -392,13 +381,11 @@ public class BridgeWindowManager implements IWindowManager { @Override public void statusBarVisibilityChanged(int arg0) throws RemoteException { // TODO Auto-generated method stub - } @Override public void stopAppFreezingScreen(IBinder arg0, boolean arg1) throws RemoteException { // TODO Auto-generated method stub - } @Override @@ -410,7 +397,6 @@ public class BridgeWindowManager implements IWindowManager { @Override public void thawRotation() throws RemoteException { // TODO Auto-generated method stub - } @Override @@ -455,4 +441,51 @@ public class BridgeWindowManager implements IWindowManager { public void lockNow() { // TODO Auto-generated method stub } + + @Override + public IBinder getFocusedWindowToken() { + // TODO Auto-generated method stub + return null; + } + + @Override + public float getWindowCompatibilityScale(IBinder windowToken) throws RemoteException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public void setInputFilter(IInputFilter filter) throws RemoteException { + // TODO Auto-generated method stub + } + + @Override + public void magnifyDisplay(int dipslayId, float scale, float offsetX, float offsetY) + throws RemoteException { + // TODO Auto-generated method stub + } + + @Override + public void addDisplayContentChangeListener(int displayId, + IDisplayContentChangeListener listener) throws RemoteException { + // TODO Auto-generated method stub + } + + @Override + public void removeDisplayContentChangeListener(int displayId, + IDisplayContentChangeListener listener) throws RemoteException { + // TODO Auto-generated method stub + } + + @Override + public WindowInfo getWindowInfo(IBinder token) throws RemoteException { + // TODO Auto-generated method stub + return null; + } + + @Override + public void getVisibleWindowsForDisplay(int displayId, List<WindowInfo> outInfos) + throws RemoteException { + // TODO Auto-generated method stub + } } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowSession.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowSession.java index 6fb599d..67b0a9c 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowSession.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowSession.java @@ -45,7 +45,24 @@ public final class BridgeWindowSession implements IWindowSession { } @Override - public int addWithoutInputChannel(IWindow arg0, int seq, LayoutParams arg1, int arg2, Rect arg3) + public int addToDisplay(IWindow arg0, int seq, LayoutParams arg1, int arg2, int displayId, + Rect arg3, InputChannel outInputchannel) + throws RemoteException { + // pass for now. + return 0; + } + + @Override + public int addWithoutInputChannel(IWindow arg0, int seq, LayoutParams arg1, int arg2, + Rect arg3) + throws RemoteException { + // pass for now. + return 0; + } + + @Override + public int addToDisplayWithoutInputChannel(IWindow arg0, int seq, LayoutParams arg1, int arg2, + int displayId, Rect arg3) throws RemoteException { // pass for now. return 0; @@ -167,8 +184,19 @@ public final class BridgeWindowSession implements IWindowSession { } @Override + public void setUniverseTransform(IBinder window, float alpha, float offx, float offy, + float dsdx, float dtdx, float dsdy, float dtdy) { + // pass for now. + } + + @Override public IBinder asBinder() { // pass for now. return null; } + + @Override + public void onRectangleOnScreenRequested(IBinder window, Rect rectangle, boolean immediate) { + // pass for now. + } } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java index 7323c6a..de65fd4 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java @@ -100,7 +100,7 @@ public abstract class RenderAction<T extends RenderParams> extends FrameworkReso // setup the display Metrics. DisplayMetrics metrics = new DisplayMetrics(); - metrics.densityDpi = mParams.getDensity().getDpiValue(); + metrics.densityDpi = metrics.noncompatDensityDpi = mParams.getDensity().getDpiValue(); metrics.density = metrics.noncompatDensity = metrics.densityDpi / (float) DisplayMetrics.DENSITY_DEFAULT; @@ -335,6 +335,7 @@ public abstract class RenderAction<T extends RenderParams> extends FrameworkReso } else { config.smallestScreenWidthDp = config.screenWidthDp; } + config.densityDpi = density.getDpiValue(); // never run in compat mode: config.compatScreenWidthDp = config.screenWidthDp; |