summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/ApplicationPackageManager.java2
-rw-r--r--core/java/android/content/pm/RegisteredServicesCache.java49
-rw-r--r--core/java/android/server/BluetoothEventLoop.java2
-rw-r--r--core/java/com/android/internal/app/ActionBarImpl.java2
-rw-r--r--core/java/com/android/internal/view/menu/MenuPopupHelper.java36
-rw-r--r--core/java/com/android/internal/widget/ActionBarView.java1
-rw-r--r--graphics/java/android/renderscript/BaseObj.java34
-rw-r--r--graphics/java/android/renderscript/RenderScript.java75
-rw-r--r--graphics/java/android/renderscript/RenderScriptGL.java10
-rw-r--r--telephony/java/com/android/internal/telephony/DataConnectionTracker.java10
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/LayoutSceneImpl.java2
11 files changed, 166 insertions, 57 deletions
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index e90ddbfcef6a..ce9501a6b156 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -892,7 +892,7 @@ final class ApplicationPackageManager extends PackageManager {
+ Integer.toHexString(resid) + " in package "
+ packageName, e);
} catch (NameNotFoundException e) {
- Log.w("PackageManager", "Failure retrieving resources for"
+ Log.w("PackageManager", "Failure retrieving resources for "
+ appInfo.packageName);
}
return null;
diff --git a/core/java/android/content/pm/RegisteredServicesCache.java b/core/java/android/content/pm/RegisteredServicesCache.java
index dce3963ea98c..06095d14078b 100644
--- a/core/java/android/content/pm/RegisteredServicesCache.java
+++ b/core/java/android/content/pm/RegisteredServicesCache.java
@@ -271,17 +271,11 @@ public abstract class RegisteredServicesCache<V> {
}
synchronized (mServicesLock) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.d(TAG, "generateServicesMap: " + mInterfaceName);
- }
if (mPersistentServices == null) {
readPersistentServicesLocked();
}
mServices = Maps.newHashMap();
- boolean changed = false;
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.d(TAG, "found " + serviceInfos.size() + " services");
- }
+ StringBuilder changes = new StringBuilder();
for (ServiceInfo<V> info : serviceInfos) {
// four cases:
// - doesn't exist yet
@@ -294,10 +288,7 @@ public abstract class RegisteredServicesCache<V> {
// - add, notify user that it was added
Integer previousUid = mPersistentServices.get(info.type);
if (previousUid == null) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.d(TAG, "encountered new type: " + info);
- }
- changed = true;
+ changes.append(" New service added: ").append(info).append("\n");
mServices.put(info.type, info);
mPersistentServices.put(info.type, info.uid);
if (!mPersistentServicesFileDidNotExist) {
@@ -305,29 +296,25 @@ public abstract class RegisteredServicesCache<V> {
}
} else if (previousUid == info.uid) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.d(TAG, "encountered existing type with the same uid: " + info);
+ changes.append(" Existing service (nop): ").append(info).append("\n");
}
mServices.put(info.type, info);
} else if (inSystemImage(info.uid)
|| !containsTypeAndUid(serviceInfos, info.type, previousUid)) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
- if (inSystemImage(info.uid)) {
- Log.d(TAG, "encountered existing type with a new uid but from"
- + " the system: " + info);
- } else {
- Log.d(TAG, "encountered existing type with a new uid but existing was"
- + " removed: " + info);
- }
+ if (inSystemImage(info.uid)) {
+ changes.append(" System service replacing existing: ").append(info)
+ .append("\n");
+ } else {
+ changes.append(" Existing service replacing a removed service: ")
+ .append(info).append("\n");
}
- changed = true;
mServices.put(info.type, info);
mPersistentServices.put(info.type, info.uid);
notifyListener(info.type, false /* removed */);
} else {
// ignore
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.d(TAG, "encountered existing type with a new uid, ignoring: " + info);
- }
+ changes.append(" Existing service with new uid ignored: ").append(info)
+ .append("\n");
}
}
@@ -339,18 +326,16 @@ public abstract class RegisteredServicesCache<V> {
}
for (V v1 : toBeRemoved) {
mPersistentServices.remove(v1);
- changed = true;
+ changes.append(" Service removed: ").append(v1).append("\n");
notifyListener(v1, true /* removed */);
}
- if (changed) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.d(TAG, "writing updated list of persistent services");
- }
+ if (changes.length() > 0) {
+ Log.d(TAG, "generateServicesMap(" + mInterfaceName + "): " +
+ serviceInfos.size() + " services:\n" + changes);
writePersistentServicesLocked();
} else {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.d(TAG, "persistent services did not change, so not writing anything");
- }
+ Log.d(TAG, "generateServicesMap(" + mInterfaceName + "): " +
+ serviceInfos.size() + " services unchanged");
}
mPersistentServicesFileDidNotExist = false;
}
diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java
index 4f562815647d..56ab6bfec500 100644
--- a/core/java/android/server/BluetoothEventLoop.java
+++ b/core/java/android/server/BluetoothEventLoop.java
@@ -287,8 +287,6 @@ class BluetoothEventLoop {
mBluetoothService.setIsDiscovering(true);
intent = new Intent(BluetoothAdapter.ACTION_DISCOVERY_STARTED);
} else {
- // Stop the discovery.
- mBluetoothService.cancelDiscovery();
mBluetoothService.setIsDiscovering(false);
intent = new Intent(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
}
diff --git a/core/java/com/android/internal/app/ActionBarImpl.java b/core/java/com/android/internal/app/ActionBarImpl.java
index 7cf369f4993a..cd1cae61a161 100644
--- a/core/java/com/android/internal/app/ActionBarImpl.java
+++ b/core/java/com/android/internal/app/ActionBarImpl.java
@@ -616,7 +616,7 @@ public class ActionBarImpl extends ActionBar {
public int getSelectedNavigationIndex() {
switch (mActionView.getNavigationMode()) {
case NAVIGATION_MODE_TABS:
- return mSelectedTab.getPosition();
+ return mSelectedTab != null ? mSelectedTab.getPosition() : -1;
case NAVIGATION_MODE_LIST:
return mActionView.getDropdownSelectedPosition();
default:
diff --git a/core/java/com/android/internal/view/menu/MenuPopupHelper.java b/core/java/com/android/internal/view/menu/MenuPopupHelper.java
index c947824020d4..1d103ed660f1 100644
--- a/core/java/com/android/internal/view/menu/MenuPopupHelper.java
+++ b/core/java/com/android/internal/view/menu/MenuPopupHelper.java
@@ -24,6 +24,7 @@ import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.View;
import android.view.View.MeasureSpec;
+import android.view.ViewTreeObserver;
import android.widget.AdapterView;
import android.widget.ListPopupWindow;
import android.widget.PopupWindow;
@@ -33,7 +34,8 @@ import java.lang.ref.WeakReference;
/**
* @hide
*/
-public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.OnKeyListener {
+public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.OnKeyListener,
+ ViewTreeObserver.OnGlobalLayoutListener {
private static final String TAG = "MenuPopupHelper";
private Context mContext;
@@ -42,6 +44,7 @@ public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.On
private int mPopupMaxWidth;
private WeakReference<View> mAnchorView;
private boolean mOverflowOnly;
+ private ViewTreeObserver mTreeObserver;
private PopupWindow.OnDismissListener mDismissListener = new PopupWindow.OnDismissListener() {
public void onDismiss() {
@@ -82,12 +85,18 @@ public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.On
mPopup.setAdapter(adapter);
mPopup.setModal(true);
- if (mAnchorView != null) {
- mPopup.setAnchorView(mAnchorView.get());
- } else if (mMenu instanceof SubMenuBuilder) {
+ View anchor = mAnchorView != null ? mAnchorView.get() : null;
+ if (anchor == null && mMenu instanceof SubMenuBuilder) {
SubMenuBuilder subMenu = (SubMenuBuilder) mMenu;
final MenuItemImpl itemImpl = (MenuItemImpl) subMenu.getItem();
- mPopup.setAnchorView(itemImpl.getItemView(MenuBuilder.TYPE_ACTION_BUTTON, null));
+ anchor = itemImpl.getItemView(MenuBuilder.TYPE_ACTION_BUTTON, null);
+ mAnchorView = new WeakReference<View>(anchor);
+ }
+
+ if (anchor != null) {
+ mTreeObserver = anchor.getViewTreeObserver();
+ mTreeObserver.addOnGlobalLayoutListener(this);
+ mPopup.setAnchorView(anchor);
} else {
throw new IllegalStateException("MenuPopupHelper cannot be used without an anchor");
}
@@ -101,6 +110,8 @@ public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.On
if (isShowing()) {
mPopup.dismiss();
}
+ mTreeObserver.removeGlobalOnLayoutListener(this);
+ mTreeObserver = null;
}
public boolean isShowing() {
@@ -115,7 +126,7 @@ public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.On
item = mMenu.getItem(position);
}
mMenu.performItemAction(item, 0);
- mPopup.dismiss();
+ dismiss();
}
public boolean onKey(View v, int keyCode, KeyEvent event) {
@@ -142,4 +153,17 @@ public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.On
}
return width;
}
+
+ @Override
+ public void onGlobalLayout() {
+ if (!isShowing()) {
+ mTreeObserver.removeGlobalOnLayoutListener(this);
+ mTreeObserver = null;
+ } else {
+ final View anchor = mAnchorView != null ? mAnchorView.get() : null;
+ if (anchor != null && !anchor.isShown()) {
+ dismiss();
+ }
+ }
+ }
}
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java
index be6a57aaf9ff..7a64da00f036 100644
--- a/core/java/com/android/internal/widget/ActionBarView.java
+++ b/core/java/com/android/internal/widget/ActionBarView.java
@@ -330,6 +330,7 @@ public class ActionBarView extends ViewGroup {
mSubtitle = subtitle;
if (mSubtitleView != null) {
mSubtitleView.setText(subtitle);
+ mSubtitleView.setVisibility(subtitle != null ? VISIBLE : GONE);
}
}
diff --git a/graphics/java/android/renderscript/BaseObj.java b/graphics/java/android/renderscript/BaseObj.java
index 026f7de10bcd..78b5617b706d 100644
--- a/graphics/java/android/renderscript/BaseObj.java
+++ b/graphics/java/android/renderscript/BaseObj.java
@@ -41,6 +41,13 @@ class BaseObj {
mID = id;
}
+ /**
+ * Lookup the native object ID for this object. Primarily used by the
+ * generated reflected code.
+ *
+ *
+ * @return int
+ */
public int getID() {
if (mDestroyed) {
throw new RSInvalidStateException("using a destroyed object.");
@@ -53,8 +60,15 @@ class BaseObj {
private String mName;
RenderScript mRS;
- public void setName(String s) {
- if(s.length() < 1) {
+ /**
+ * setName assigns a name to an object. This object can later be looked up
+ * by this name. This name will also be retained if the object is written
+ * to an A3D file.
+ *
+ * @param name The name to assign to the object.
+ */
+ public void setName(String name) {
+ if(name.length() < 1) {
throw new RSIllegalArgumentException("setName does not accept a zero length string.");
}
if(mName != null) {
@@ -62,9 +76,9 @@ class BaseObj {
}
try {
- byte[] bytes = s.getBytes("UTF-8");
+ byte[] bytes = name.getBytes("UTF-8");
mRS.nAssignName(mID, bytes);
- mName = s;
+ mName = name;
} catch (java.io.UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
@@ -84,6 +98,12 @@ class BaseObj {
super.finalize();
}
+ /**
+ * destroy disconnects the object from the native object effectivly
+ * rendering this java object dead. The primary use is to force immediate
+ * cleanup of resources when its believed the GC will not respond quickly
+ * enough.
+ */
synchronized public void destroy() {
if(mDestroyed) {
throw new RSInvalidStateException("Object already destroyed.");
@@ -92,8 +112,10 @@ class BaseObj {
mRS.nObjDestroy(mID);
}
- // If an object came from an a3d file, java fields need to be
- // created with objects from the native layer
+ /**
+ * If an object came from an a3d file, java fields need to be
+ * created with objects from the native layer
+ */
void updateFromNative() {
mRS.validate();
mName = mRS.nGetName(getID());
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index 64afb6fa4d14..df03e1358f4d 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -28,6 +28,13 @@ import android.view.Surface;
/**
* @hide
*
+ * RenderScript base master class. An instance of this class creates native
+ * worker threads for processing commands from this object. This base class
+ * does not provide any extended capabilities beyond simple data processing.
+ * For extended capabilities use derived classes such as RenderScriptGL.
+ *
+ *
+ *
**/
public class RenderScript {
static final String LOG_TAG = "RenderScript_jni";
@@ -581,6 +588,14 @@ public class RenderScript {
///////////////////////////////////////////////////////////////////////////////////
//
+ /**
+ * Base class application should derive from for handling RS messages
+ * comming from their scripts. When a script calls sendToClient the data
+ * fields will be filled in and then the run method called by a message
+ * handling thread. This will occur some time after sendToClient completes
+ * in the script.
+ *
+ */
public static class RSMessage implements Runnable {
protected int[] mData;
protected int mID;
@@ -588,16 +603,42 @@ public class RenderScript {
public void run() {
}
}
+ /**
+ * If an application is expecting messages it should set this field to an
+ * instance of RSMessage. This instance will receive all the user messages
+ * sent from sendToClient by scripts from this context.
+ *
+ */
public RSMessage mMessageCallback = null;
+ /**
+ * Runtime error base class. An application should derive from this class
+ * if it wishes to install an error handler. When errors occur at runtime
+ * the fields in this class will be filled and the run method called.
+ *
+ */
public static class RSAsyncError implements Runnable {
protected String mErrorMessage;
protected int mErrorNum;
public void run() {
}
}
+
+ /**
+ * Application Error handler. All runtime errors will be dispatched to the
+ * instance of RSAsyncError set here. If this field is null a
+ * RSRuntimeException will instead be thrown with details about the error.
+ * This will cause program termaination.
+ *
+ */
public RSAsyncError mErrorCallback = null;
+ /**
+ * RenderScript worker threads priority enumeration. The default value is
+ * NORMAL. Applications wishing to do background processing such as
+ * wallpapers should set their priority to LOW to avoid starving forground
+ * processes.
+ */
public enum Priority {
LOW (5), //ANDROID_PRIORITY_BACKGROUND + 5
NORMAL (-4); //ANDROID_PRIORITY_DISPLAY
@@ -614,6 +655,12 @@ public class RenderScript {
}
}
+
+ /**
+ * Change the priority of the worker threads for this context.
+ *
+ * @param p New priority to be set.
+ */
public void contextSetPriority(Priority p) {
validate();
nContextSetPriority(p.mID);
@@ -690,9 +737,15 @@ public class RenderScript {
}
}
- protected RenderScript() {
+ RenderScript() {
}
+ /**
+ * Create a basic RenderScript context.
+ *
+ *
+ * @return RenderScript
+ */
public static RenderScript create() {
RenderScript rs = new RenderScript();
@@ -704,15 +757,32 @@ public class RenderScript {
return rs;
}
+ /**
+ * Print the currently available debugging information about the state of
+ * the RS context to the log.
+ *
+ *
+ * @param bits Currently ignored.
+ */
public void contextDump(int bits) {
validate();
nContextDump(bits);
}
+ /**
+ * Wait for any commands in the fifo between the java bindings and native to
+ * be processed.
+ *
+ */
public void finish() {
nContextFinish();
}
+ /**
+ * Destroy this renderscript context. Once this function is called its no
+ * longer legal to use this or any objects created by this context.
+ *
+ */
public void destroy() {
validate();
nContextDeinitToClient(mContext);
@@ -733,9 +803,6 @@ public class RenderScript {
return mContext != 0;
}
- ///////////////////////////////////////////////////////////////////////////////////
- // Root state
-
protected int safeID(BaseObj o) {
if(o != null) {
return o.getID();
diff --git a/graphics/java/android/renderscript/RenderScriptGL.java b/graphics/java/android/renderscript/RenderScriptGL.java
index cace0636ab9c..181d4bd5aec3 100644
--- a/graphics/java/android/renderscript/RenderScriptGL.java
+++ b/graphics/java/android/renderscript/RenderScriptGL.java
@@ -30,12 +30,22 @@ import android.view.SurfaceView;
/**
* @hide
*
+ * The Graphics derivitive of RenderScript. Extends the basic context to add a
+ * root script which is the display window for graphical output. When the
+ * system needs to update the display the currently bound root script will be
+ * called. This script is expected to issue the rendering commands to repaint
+ * the screen.
**/
public class RenderScriptGL extends RenderScript {
private Surface mSurface;
int mWidth;
int mHeight;
+ /**
+ * Class which is used to describe a pixel format for a graphical buffer.
+ * This is used to describe the intended format of the display surface.
+ *
+ */
public static class SurfaceConfig {
int mDepthMin = 0;
int mDepthPref = 0;
diff --git a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
index 2a21f6d93399..96c90a2dbb42 100644
--- a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
@@ -478,7 +478,7 @@ public abstract class DataConnectionTracker extends Handler {
* {@code true} otherwise.
*/
public synchronized boolean getDataEnabled() {
- return dataEnabled[APN_DEFAULT_ID];
+ return (mMasterDataEnabled && dataEnabled[APN_DEFAULT_ID]);
}
/**
@@ -487,8 +487,8 @@ public abstract class DataConnectionTracker extends Handler {
* @return {@code false} if data connectivity has been explicitly disabled,
* {@code true} otherwise.
*/
- public boolean getAnyDataEnabled() {
- return (enabledCount != 0);
+ public synchronized boolean getAnyDataEnabled() {
+ return (mMasterDataEnabled && (enabledCount != 0));
}
protected abstract void startNetStatPoll();
@@ -832,7 +832,9 @@ public abstract class DataConnectionTracker extends Handler {
protected void onSetDataEnabled(boolean enable) {
if (mMasterDataEnabled != enable) {
- mMasterDataEnabled = enable;
+ synchronized (this) {
+ mMasterDataEnabled = enable;
+ }
if (enable) {
mRetryMgr.resetRetryCount();
onTrySetupData(Phone.REASON_DATA_ENABLED);
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/LayoutSceneImpl.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/LayoutSceneImpl.java
index 2012229dccd4..d8a59cec3581 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/LayoutSceneImpl.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/LayoutSceneImpl.java
@@ -295,7 +295,7 @@ public class LayoutSceneImpl {
if (mParams.isCustomBackgroundEnabled()) {
Graphics2D gc = mImage.createGraphics();
- gc.setColor(new Color(mParams.getCustomBackgroundColor()));
+ gc.setColor(new Color(mParams.getCustomBackgroundColor(), true));
gc.fillRect(0, 0, renderScreenWidth, renderScreenHeight - mScreenOffset);
gc.dispose();
}