diff options
| -rw-r--r-- | core/java/android/net/NetworkStateTracker.java | 6 | ||||
| -rw-r--r-- | core/java/android/widget/RemoteViewsAdapter.java | 163 | ||||
| -rw-r--r-- | core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp | 2 | ||||
| -rw-r--r-- | core/jni/android_view_GLES20Canvas.cpp | 4 | ||||
| -rw-r--r-- | docs/html/distribute/googleplay/about/monetizing.jd | 2 | ||||
| -rw-r--r-- | graphics/jni/android_renderscript_RenderScript.cpp | 8 | ||||
| -rw-r--r-- | libs/hwui/DisplayListRenderer.cpp | 12 | ||||
| -rw-r--r-- | libs/hwui/DisplayListRenderer.h | 4 | ||||
| -rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 4 | ||||
| -rw-r--r-- | libs/hwui/OpenGLRenderer.h | 2 | ||||
| -rw-r--r-- | packages/SystemUI/res/layout/status_bar_expanded.xml | 20 | ||||
| -rw-r--r-- | packages/SystemUI/res/values/styles.xml | 3 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java | 42 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java | 24 | ||||
| -rw-r--r-- | services/java/com/android/server/ConnectivityService.java | 95 |
15 files changed, 171 insertions, 220 deletions
diff --git a/core/java/android/net/NetworkStateTracker.java b/core/java/android/net/NetworkStateTracker.java index 7df0193c8b1e..313c1744db29 100644 --- a/core/java/android/net/NetworkStateTracker.java +++ b/core/java/android/net/NetworkStateTracker.java @@ -41,12 +41,6 @@ public interface NetworkStateTracker { * ------------------------------------------------------------- */ - // Share the event space with ConnectivityService (which we can't see, but - // must send events to). If you change these, change ConnectivityService - // too. - static final int MIN_NETWORK_STATE_TRACKER_EVENT = 1; - static final int MAX_NETWORK_STATE_TRACKER_EVENT = 100; - /** * The network state has changed and the NetworkInfo object * contains the new state. diff --git a/core/java/android/widget/RemoteViewsAdapter.java b/core/java/android/widget/RemoteViewsAdapter.java index 56782c37f5e6..f0109ce947ce 100644 --- a/core/java/android/widget/RemoteViewsAdapter.java +++ b/core/java/android/widget/RemoteViewsAdapter.java @@ -29,8 +29,6 @@ import android.os.HandlerThread; import android.os.IBinder; import android.os.Looper; import android.os.Message; -import android.os.Parcel; -import android.os.Parcelable; import android.os.RemoteException; import android.util.Log; import android.util.Pair; @@ -50,7 +48,7 @@ import com.android.internal.widget.IRemoteViewsFactory; public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback { private static final String TAG = "RemoteViewsAdapter"; - // The max number of items in the cache + // The max number of items in the cache private static final int sDefaultCacheSize = 40; // The delay (in millis) to wait until attempting to unbind from a service after a request. // This ensures that we don't stay continually bound to the service and that it can be destroyed @@ -61,7 +59,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback private static final int sDefaultLoadingViewHeight = 50; // Type defs for controlling different messages across the main and worker message queues - private static final int sDefaultMessageType = 0; + private static final int sDefaultMessageType = 0; private static final int sUnbindServiceMessageType = 1; private final Context mContext; @@ -88,9 +86,9 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback // We cache the FixedSizeRemoteViewsCaches across orientation. These are the related data // structures; - private static final HashMap<Pair<Intent.FilterComparison, Integer>, Parcel> + private static final HashMap<Pair<Intent.FilterComparison, Integer>, FixedSizeRemoteViewsCache> sCachedRemoteViewsCaches = new HashMap<Pair<Intent.FilterComparison, Integer>, - Parcel>(); + FixedSizeRemoteViewsCache>(); private static final HashMap<Pair<Intent.FilterComparison, Integer>, Runnable> sRemoteViewsCacheRemoveRunnables = new HashMap<Pair<Intent.FilterComparison, Integer>, Runnable>(); @@ -354,7 +352,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback /** * The meta-data associated with the cache in it's current state. */ - private static class RemoteViewsMetaData implements Parcelable { + private static class RemoteViewsMetaData { int count; int viewTypeCount; boolean hasStableIds; @@ -373,51 +371,6 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback reset(); } - public RemoteViewsMetaData(Parcel src) { - count = src.readInt(); - viewTypeCount = src.readInt(); - hasStableIds = src.readInt() == 0 ? false : true; - mFirstViewHeight = src.readInt(); - if (src.readInt() != 0) { - mUserLoadingView = new RemoteViews(src); - } - if (src.readInt() != 0) { - mFirstView = new RemoteViews(src); - } - int count = src.readInt(); - for (int i = 0; i < count; i++) { - mTypeIdIndexMap.put(src.readInt(), src.readInt()); - } - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(count); - dest.writeInt(viewTypeCount); - dest.writeInt(hasStableIds ? 1 : 0); - dest.writeInt(mFirstViewHeight); - dest.writeInt(mUserLoadingView != null ? 1 : 0); - if (mUserLoadingView != null) { - mUserLoadingView.writeToParcel(dest, flags); - } - dest.writeInt(mFirstView != null ? 1 : 0); - if (mFirstView != null) { - mFirstView.writeToParcel(dest, flags); - } - - int count = mTypeIdIndexMap.size(); - dest.writeInt(count); - for (Integer key: mTypeIdIndexMap.keySet()) { - dest.writeInt(key); - dest.writeInt(mTypeIdIndexMap.get(key)); - } - } - - @Override - public int describeContents() { - return 0; - } - public void set(RemoteViewsMetaData d) { synchronized (d) { count = d.count; @@ -528,7 +481,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback /** * The meta-data associated with a single item in the cache. */ - private static class RemoteViewsIndexMetaData implements Parcelable { + private static class RemoteViewsIndexMetaData { int typeId; long itemId; @@ -536,22 +489,6 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback set(v, itemId); } - public RemoteViewsIndexMetaData(Parcel src) { - typeId = src.readInt(); - itemId = src.readLong(); - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(typeId); - dest.writeLong(itemId); - } - - @Override - public int describeContents() { - return 0; - } - public void set(RemoteViews v, long id) { itemId = id; if (v != null) { @@ -565,7 +502,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback /** * */ - private static class FixedSizeRemoteViewsCache implements Parcelable { + private static class FixedSizeRemoteViewsCache { private static final String TAG = "FixedSizeRemoteViewsCache"; // The meta data related to all the RemoteViews, ie. count, is stable, etc. @@ -627,57 +564,6 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback mLoadIndices = new HashSet<Integer>(); } - public FixedSizeRemoteViewsCache(Parcel src) { - mMaxCount = src.readInt(); - mMaxCountSlack = src.readInt(); - mPreloadLowerBound = src.readInt(); - mPreloadUpperBound = src.readInt(); - mMetaData = new RemoteViewsMetaData(src); - int count = src.readInt(); - mIndexMetaData = new HashMap<Integer, RemoteViewsIndexMetaData>(); - for (int i = 0; i < count; i++) { - mIndexMetaData.put(src.readInt(), new RemoteViewsIndexMetaData(src)); - } - count = src.readInt(); - mIndexRemoteViews = new HashMap<Integer, RemoteViews>(); - for (int i = 0; i < count; i++) { - mIndexRemoteViews.put(src.readInt(), new RemoteViews(src)); - } - - mTemporaryMetaData = new RemoteViewsMetaData(); - mRequestedIndices = new HashSet<Integer>(); - mLastRequestedIndex = -1; - mLoadIndices = new HashSet<Integer>(); - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(mMaxCount); - dest.writeInt(mMaxCountSlack); - dest.writeInt(mPreloadLowerBound); - dest.writeInt(mPreloadUpperBound); - mMetaData.writeToParcel(dest, 0); - - // We write the index data and cache - int count = mIndexMetaData.size(); - dest.writeInt(count); - for (Integer key: mIndexMetaData.keySet()) { - dest.writeInt(key); - mIndexMetaData.get(key).writeToParcel(dest, flags); - } - count = mIndexRemoteViews.size(); - dest.writeInt(count); - for (Integer key: mIndexRemoteViews.keySet()) { - dest.writeInt(key); - mIndexRemoteViews.get(key).writeToParcel(dest, flags); - } - } - - @Override - public int describeContents() { - return 0; - } - public void insert(int position, RemoteViews v, long itemId, ArrayList<Integer> visibleWindow) { // Trim the cache if we go beyond the count @@ -897,12 +783,18 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback synchronized(sCachedRemoteViewsCaches) { if (sCachedRemoteViewsCaches.containsKey(key)) { - Parcel src = sCachedRemoteViewsCaches.get(key); - src.setDataPosition(0); - mCache = new FixedSizeRemoteViewsCache(src); - mDataReady = true; + mCache = sCachedRemoteViewsCaches.get(key); + synchronized (mCache.mMetaData) { + if (mCache.mMetaData.count > 0) { + // As a precautionary measure, we verify that the meta data indicates a + // non-zero count before declaring that data is ready. + mDataReady = true; + } + } } else { mCache = new FixedSizeRemoteViewsCache(sDefaultCacheSize); + } + if (!mDataReady) { requestBindService(); } } @@ -934,11 +826,18 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback sRemoteViewsCacheRemoveRunnables.remove(key); } - Parcel p = Parcel.obtain(); - synchronized(mCache) { - mCache.writeToParcel(p, 0); + int metaDataCount = 0; + int numRemoteViewsCached = 0; + synchronized (mCache.mMetaData) { + metaDataCount = mCache.mMetaData.count; } - sCachedRemoteViewsCaches.put(key, p); + synchronized (mCache) { + numRemoteViewsCached = mCache.mIndexRemoteViews.size(); + } + if (metaDataCount > 0 && numRemoteViewsCached > 0) { + sCachedRemoteViewsCaches.put(key, mCache); + } + Runnable r = new Runnable() { @Override public void run() { @@ -1332,6 +1231,12 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback private ArrayList<Integer> getVisibleWindow(int lower, int upper, int count) { ArrayList<Integer> window = new ArrayList<Integer>(); + + // In the case that the window is invalid or uninitialized, return an empty window. + if ((lower == 0 && upper == 0) || lower < 0 || upper < 0) { + return window; + } + if (lower <= upper) { for (int i = lower; i <= upper; i++){ window.add(i); diff --git a/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp b/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp index 6ce3f51925ac..aa4cbde2f7ca 100644 --- a/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp +++ b/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp @@ -164,7 +164,7 @@ SkStream* CreateJavaInputStreamAdaptor(JNIEnv* env, jobject stream, RETURN_NULL_IF_NULL(gInputStream_resetMethodID); RETURN_NULL_IF_NULL(gInputStream_markMethodID); RETURN_NULL_IF_NULL(gInputStream_availableMethodID); - RETURN_NULL_IF_NULL(gInputStream_availableMethodID); + RETURN_NULL_IF_NULL(gInputStream_readMethodID); RETURN_NULL_IF_NULL(gInputStream_skipMethodID); gInited = true; diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp index ade3180bb4b8..9fc73a4f15fa 100644 --- a/core/jni/android_view_GLES20Canvas.cpp +++ b/core/jni/android_view_GLES20Canvas.cpp @@ -531,7 +531,7 @@ static void renderText(OpenGLRenderer* renderer, const jchar* text, int count, jfloat totalAdvance = value->getTotalAdvance(); const float* positions = value->getPos(); int bytesCount = glyphsCount * sizeof(jchar); - renderer->drawGeneralText((const char*) glyphs, bytesCount, glyphsCount, x, y, + renderer->drawText((const char*) glyphs, bytesCount, glyphsCount, x, y, positions, paint, totalAdvance); } @@ -562,7 +562,7 @@ static void renderTextRun(OpenGLRenderer* renderer, const jchar* text, jfloat totalAdvance = value->getTotalAdvance(); const float* positions = value->getPos(); int bytesCount = glyphsCount * sizeof(jchar); - renderer->drawGeneralText((const char*) glyphs, bytesCount, glyphsCount, x, y, + renderer->drawText((const char*) glyphs, bytesCount, glyphsCount, x, y, positions, paint, totalAdvance); } diff --git a/docs/html/distribute/googleplay/about/monetizing.jd b/docs/html/distribute/googleplay/about/monetizing.jd index 2fa2da891640..4980edaecbbe 100644 --- a/docs/html/distribute/googleplay/about/monetizing.jd +++ b/docs/html/distribute/googleplay/about/monetizing.jd @@ -42,7 +42,7 @@ manages the application download.</p> <h3 id="payment-methods">Convenient payment options</h3> <p>Users can purchase your products on Google Play using several convenient -payment methods—credit cards, Direct Carrier Billing, and Google Play balance..</p> +payment methods—credit cards, Direct Carrier Billing, and Google Play balance.</p> <p><span style="font-weight:500">Credit card</span> is the most common method of payment. Users can pay using any credit card that they’ve registered in Google Play. To make it easy for users to get started, diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp index 8c8ff4dcae14..09f69527cd41 100644 --- a/graphics/jni/android_renderscript_RenderScript.cpp +++ b/graphics/jni/android_renderscript_RenderScript.cpp @@ -718,7 +718,7 @@ nAllocationRead_i(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jintAr LOG_API("nAllocationRead_i, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len); jint *ptr = _env->GetIntArrayElements(data, NULL); jsize length = _env->GetArrayLength(data); - rsAllocationRead(con, (RsAllocation)alloc, ptr, length); + rsAllocationRead(con, (RsAllocation)alloc, ptr, length * sizeof(int)); _env->ReleaseIntArrayElements(data, ptr, 0); } @@ -729,7 +729,7 @@ nAllocationRead_s(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jshort LOG_API("nAllocationRead_i, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len); jshort *ptr = _env->GetShortArrayElements(data, NULL); jsize length = _env->GetArrayLength(data); - rsAllocationRead(con, (RsAllocation)alloc, ptr, length); + rsAllocationRead(con, (RsAllocation)alloc, ptr, length * sizeof(short)); _env->ReleaseShortArrayElements(data, ptr, 0); } @@ -740,7 +740,7 @@ nAllocationRead_b(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jbyteA LOG_API("nAllocationRead_i, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len); jbyte *ptr = _env->GetByteArrayElements(data, NULL); jsize length = _env->GetArrayLength(data); - rsAllocationRead(con, (RsAllocation)alloc, ptr, length); + rsAllocationRead(con, (RsAllocation)alloc, ptr, length * sizeof(char)); _env->ReleaseByteArrayElements(data, ptr, 0); } @@ -751,7 +751,7 @@ nAllocationRead_f(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jfloat LOG_API("nAllocationRead_f, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len); jfloat *ptr = _env->GetFloatArrayElements(data, NULL); jsize length = _env->GetArrayLength(data); - rsAllocationRead(con, (RsAllocation)alloc, ptr, length); + rsAllocationRead(con, (RsAllocation)alloc, ptr, length * sizeof(float)); _env->ReleaseFloatArrayElements(data, ptr, 0); } diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp index 7161c589b191..76321be271d3 100644 --- a/libs/hwui/DisplayListRenderer.cpp +++ b/libs/hwui/DisplayListRenderer.cpp @@ -63,7 +63,7 @@ const char* DisplayList::OP_NAMES[] = { "DrawPoints", "DrawTextOnPath", "DrawPosText", - "DrawGeneralText", + "DrawText", "ResetShader", "SetupShader", "ResetColorFilter", @@ -593,7 +593,7 @@ void DisplayList::output(OpenGLRenderer& renderer, uint32_t level) { text.text(), text.length(), count, paint); } break; - case DrawGeneralText: { + case DrawText: { getText(&text); int count = getInt(); int positionsCount = 0; @@ -1221,7 +1221,7 @@ status_t DisplayList::replay(OpenGLRenderer& renderer, Rect& dirty, int32_t flag positions, paint); } break; - case DrawGeneralText: { + case DrawText: { getText(&text); int32_t count = getInt(); float x = getFloat(); @@ -1232,7 +1232,7 @@ status_t DisplayList::replay(OpenGLRenderer& renderer, Rect& dirty, int32_t flag float length = getFloat(); DISPLAY_LIST_LOGD("%s%s %s, %d, %d, %.2f, %.2f, %p, %.2f", (char*) indent, OP_NAMES[op], text.text(), text.length(), count, x, y, paint, length); - drawGlStatus |= renderer.drawGeneralText(text.text(), text.length(), count, + drawGlStatus |= renderer.drawText(text.text(), text.length(), count, x, y, positions, paint, length); } break; @@ -1712,7 +1712,7 @@ status_t DisplayListRenderer::drawPosText(const char* text, int bytesCount, int return DrawGlInfo::kStatusDone; } -status_t DisplayListRenderer::drawGeneralText(const char* text, int bytesCount, int count, +status_t DisplayListRenderer::drawText(const char* text, int bytesCount, int count, float x, float y, const float* positions, SkPaint* paint, float length) { if (!text || count <= 0) return DrawGlInfo::kStatusDone; @@ -1733,7 +1733,7 @@ status_t DisplayListRenderer::drawGeneralText(const char* text, int bytesCount, reject = quickReject(x, y + metrics.fTop, x + length, y + metrics.fBottom); } - uint32_t* location = addOp(DisplayList::DrawGeneralText, reject); + uint32_t* location = addOp(DisplayList::DrawText, reject); addText(text, bytesCount); addInt(count); addFloat(x); diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h index f3041dd8be7e..60a40c6b76be 100644 --- a/libs/hwui/DisplayListRenderer.h +++ b/libs/hwui/DisplayListRenderer.h @@ -105,7 +105,7 @@ public: DrawPoints, DrawTextOnPath, DrawPosText, - DrawGeneralText, + DrawText, ResetShader, SetupShader, ResetColorFilter, @@ -603,7 +603,7 @@ public: float hOffset, float vOffset, SkPaint* paint); virtual status_t drawPosText(const char* text, int bytesCount, int count, const float* positions, SkPaint* paint); - virtual status_t drawGeneralText(const char* text, int bytesCount, int count, + virtual status_t drawText(const char* text, int bytesCount, int count, float x, float y, const float* positions, SkPaint* paint, float length); virtual void resetShader(); diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 07281ccf19c9..d0d5af5e5b2d 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -2421,7 +2421,7 @@ status_t OpenGLRenderer::drawPosText(const char* text, int bytesCount, int count return DrawGlInfo::kStatusDrew; } -status_t OpenGLRenderer::drawGeneralText(const char* text, int bytesCount, int count, +status_t OpenGLRenderer::drawText(const char* text, int bytesCount, int count, float x, float y, const float* positions, SkPaint* paint, float length) { if (text == NULL || count == 0 || mSnapshot->isIgnored() || (paint->getAlpha() * mSnapshot->alpha == 0 && paint->getXfermode() == NULL)) { @@ -2455,7 +2455,7 @@ status_t OpenGLRenderer::drawGeneralText(const char* text, int bytesCount, int c } #if DEBUG_GLYPHS - ALOGD("OpenGLRenderer drawGeneralText() with FontID=%d", + ALOGD("OpenGLRenderer drawText() with FontID=%d", SkTypeface::UniqueID(paint->getTypeface())); #endif diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h index 378fc8c1e3be..51683e1e0942 100644 --- a/libs/hwui/OpenGLRenderer.h +++ b/libs/hwui/OpenGLRenderer.h @@ -142,7 +142,7 @@ public: float hOffset, float vOffset, SkPaint* paint); virtual status_t drawPosText(const char* text, int bytesCount, int count, const float* positions, SkPaint* paint); - virtual status_t drawGeneralText(const char* text, int bytesCount, int count, float x, float y, + virtual status_t drawText(const char* text, int bytesCount, int count, float x, float y, const float* positions, SkPaint* paint, float length = -1.0f); virtual void resetShader(); diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml index 47e5b7194488..5841978c2cd0 100644 --- a/packages/SystemUI/res/layout/status_bar_expanded.xml +++ b/packages/SystemUI/res/layout/status_bar_expanded.xml @@ -40,24 +40,34 @@ android:visibility="invisible" /> - <FrameLayout + <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginBottom="@dimen/close_handle_underlap" + android:orientation="vertical" > <include layout="@layout/status_bar_expanded_header" android:layout_width="match_parent" android:layout_height="@dimen/notification_panel_header_height" /> - + + <TextView + android:id="@+id/emergency_calls_only" + android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Network.EmergencyOnly" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:paddingBottom="4dp" + android:gravity="center" + android:visibility="gone" + /> + <ScrollView android:id="@+id/scroll" android:layout_width="match_parent" android:layout_height="match_parent" android:fadingEdge="none" - android:overScrollMode="ifContentScrolls" - android:layout_marginTop="@dimen/notification_panel_header_height" + android:overScrollMode="always" > <com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@+id/latestItems" @@ -66,7 +76,7 @@ systemui:rowHeight="@dimen/notification_row_min_height" /> </ScrollView> - </FrameLayout> + </LinearLayout> <com.android.systemui.statusbar.phone.CloseDragHandle android:id="@+id/close" android:layout_width="match_parent" diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index 1d5bf3c70713..2564003b2914 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -67,6 +67,9 @@ <item name="android:textColor">#999999</item> </style> + <style name="TextAppearance.StatusBar.Expanded.Network.EmergencyOnly"> + </style> + <style name="Animation" /> <style name="Animation.ShirtPocketPanel"> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 25de109cf964..16e934525115 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -186,6 +186,7 @@ public class PhoneStatusBar extends BaseStatusBar { private TextView mCarrierLabel; private boolean mCarrierLabelVisible = false; private int mCarrierLabelHeight; + private TextView mEmergencyCallLabel; // drag bar CloseDragHandle mCloseView; @@ -402,14 +403,6 @@ public class PhoneStatusBar extends BaseStatusBar { mPile = (NotificationRowLayout)mStatusBarWindow.findViewById(R.id.latestItems); mPile.setLayoutTransitionsEnabled(false); mPile.setLongPressListener(getNotificationLongClicker()); - if (SHOW_CARRIER_LABEL) { - mPile.setOnSizeChangedListener(new OnSizeChangedListener() { - @Override - public void onSizeChanged(View view, int w, int h, int oldw, int oldh) { - updateCarrierLabelVisibility(false); - } - }); - } mExpandedContents = mPile; // was: expanded.findViewById(R.id.notificationLinearLayout); mClearButton = mStatusBarWindow.findViewById(R.id.clear_all_button); @@ -422,9 +415,6 @@ public class PhoneStatusBar extends BaseStatusBar { mSettingsButton.setOnClickListener(mSettingsButtonListener); mRotationButton = (RotationToggle) mStatusBarWindow.findViewById(R.id.rotation_lock_button); - mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label); - mCarrierLabel.setVisibility(mCarrierLabelVisible ? View.VISIBLE : View.INVISIBLE); - mScrollView = (ScrollView)mStatusBarWindow.findViewById(R.id.scroll); mScrollView.setVerticalScrollBarEnabled(false); // less drawing during pulldowns @@ -453,7 +443,21 @@ public class PhoneStatusBar extends BaseStatusBar { mNetworkController.addSignalCluster(signalCluster); signalCluster.setNetworkController(mNetworkController); + mEmergencyCallLabel = (TextView)mStatusBarWindow.findViewById(R.id.emergency_calls_only); + if (mEmergencyCallLabel != null) { + mNetworkController.addEmergencyLabelView(mEmergencyCallLabel); + mEmergencyCallLabel.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { + @Override + public void onLayoutChange(View v, int left, int top, int right, int bottom, + int oldLeft, int oldTop, int oldRight, int oldBottom) { + updateCarrierLabelVisibility(false); + }}); + } + if (SHOW_CARRIER_LABEL) { + mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label); + mCarrierLabel.setVisibility(mCarrierLabelVisible ? View.VISIBLE : View.INVISIBLE); + // for mobile devices, we always show mobile connection info here (SPN/PLMN) // for other devices, we show whatever network is connected if (mNetworkController.hasMobileDataFeature()) { @@ -461,6 +465,14 @@ public class PhoneStatusBar extends BaseStatusBar { } else { mNetworkController.addCombinedLabelView(mCarrierLabel); } + + // set up the dynamic hide/show of the label + mPile.setOnSizeChangedListener(new OnSizeChangedListener() { + @Override + public void onSizeChanged(View view, int w, int h, int oldw, int oldh) { + updateCarrierLabelVisibility(false); + } + }); } // final ImageView wimaxRSSI = @@ -904,9 +916,11 @@ public class PhoneStatusBar extends BaseStatusBar { Slog.d(TAG, String.format("pileh=%d scrollh=%d carrierh=%d", mPile.getHeight(), mScrollView.getHeight(), mCarrierLabelHeight)); } - - final boolean makeVisible = - mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight); + + final boolean emergencyCallsShownElsewhere = mEmergencyCallLabel != null; + final boolean makeVisible = + !(emergencyCallsShownElsewhere && mNetworkController.isEmergencyOnly()) + && mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight); if (force || mCarrierLabelVisible != makeVisible) { mCarrierLabelVisible = makeVisible; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java index 9035e4537a8d..8711a8d4f802 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java @@ -146,6 +146,7 @@ public class NetworkController extends BroadcastReceiver { ArrayList<TextView> mCombinedLabelViews = new ArrayList<TextView>(); ArrayList<TextView> mMobileLabelViews = new ArrayList<TextView>(); ArrayList<TextView> mWifiLabelViews = new ArrayList<TextView>(); + ArrayList<TextView> mEmergencyLabelViews = new ArrayList<TextView>(); ArrayList<SignalCluster> mSignalClusters = new ArrayList<SignalCluster>(); int mLastPhoneSignalIconId = -1; int mLastDataDirectionIconId = -1; @@ -246,6 +247,10 @@ public class NetworkController extends BroadcastReceiver { return mHasMobileDataFeature; } + public boolean isEmergencyOnly() { + return (mServiceState != null && mServiceState.isEmergencyOnly()); + } + public void addPhoneSignalIconView(ImageView v) { mPhoneSignalIconViews.add(v); } @@ -285,6 +290,10 @@ public class NetworkController extends BroadcastReceiver { mWifiLabelViews.add(v); } + public void addEmergencyLabelView(TextView v) { + mEmergencyLabelViews.add(v); + } + public void addSignalCluster(SignalCluster cluster) { mSignalClusters.add(cluster); refreshSignalCluster(cluster); @@ -920,7 +929,7 @@ public class NetworkController extends BroadcastReceiver { String wifiLabel = ""; String mobileLabel = ""; int N; - final boolean emergencyOnly = (mServiceState != null && mServiceState.isEmergencyOnly()); + final boolean emergencyOnly = isEmergencyOnly(); if (!mHasMobileDataFeature) { mDataSignalIconId = mPhoneSignalIconId = 0; @@ -1082,6 +1091,7 @@ public class NetworkController extends BroadcastReceiver { + " combinedActivityIconId=0x" + Integer.toHexString(combinedActivityIconId) + " mobileLabel=" + mobileLabel + " wifiLabel=" + wifiLabel + + " emergencyOnly=" + emergencyOnly + " combinedLabel=" + combinedLabel + " mAirplaneMode=" + mAirplaneMode + " mDataActivity=" + mDataActivity @@ -1247,6 +1257,18 @@ public class NetworkController extends BroadcastReceiver { v.setVisibility(View.VISIBLE); } } + + // e-call label + N = mEmergencyLabelViews.size(); + for (int i=0; i<N; i++) { + TextView v = mEmergencyLabelViews.get(i); + if (!emergencyOnly) { + v.setVisibility(View.GONE); + } else { + v.setText(mobileLabel); // comes from the telephony stack + v.setVisibility(View.VISIBLE); + } + } } public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index 9f9390195f62..a550f34ce9a3 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -188,95 +188,81 @@ public class ConnectivityService extends IConnectivityManager.Stub { private static final boolean TO_DEFAULT_TABLE = true; private static final boolean TO_SECONDARY_TABLE = false; - // Share the event space with NetworkStateTracker (which can't see this - // internal class but sends us events). If you change these, change - // NetworkStateTracker.java too. - private static final int MIN_NETWORK_STATE_TRACKER_EVENT = 1; - private static final int MAX_NETWORK_STATE_TRACKER_EVENT = 100; - /** * used internally as a delayed event to make us switch back to the * default network */ - private static final int EVENT_RESTORE_DEFAULT_NETWORK = - MAX_NETWORK_STATE_TRACKER_EVENT + 1; + private static final int EVENT_RESTORE_DEFAULT_NETWORK = 1; /** * used internally to change our mobile data enabled flag */ - private static final int EVENT_CHANGE_MOBILE_DATA_ENABLED = - MAX_NETWORK_STATE_TRACKER_EVENT + 2; + private static final int EVENT_CHANGE_MOBILE_DATA_ENABLED = 2; /** * used internally to change our network preference setting * arg1 = networkType to prefer */ - private static final int EVENT_SET_NETWORK_PREFERENCE = - MAX_NETWORK_STATE_TRACKER_EVENT + 3; + private static final int EVENT_SET_NETWORK_PREFERENCE = 3; /** * used internally to synchronize inet condition reports * arg1 = networkType * arg2 = condition (0 bad, 100 good) */ - private static final int EVENT_INET_CONDITION_CHANGE = - MAX_NETWORK_STATE_TRACKER_EVENT + 4; + private static final int EVENT_INET_CONDITION_CHANGE = 4; /** * used internally to mark the end of inet condition hold periods * arg1 = networkType */ - private static final int EVENT_INET_CONDITION_HOLD_END = - MAX_NETWORK_STATE_TRACKER_EVENT + 5; + private static final int EVENT_INET_CONDITION_HOLD_END = 5; /** * used internally to set enable/disable cellular data * arg1 = ENBALED or DISABLED */ - private static final int EVENT_SET_MOBILE_DATA = - MAX_NETWORK_STATE_TRACKER_EVENT + 7; + private static final int EVENT_SET_MOBILE_DATA = 7; /** * used internally to clear a wakelock when transitioning * from one net to another */ - private static final int EVENT_CLEAR_NET_TRANSITION_WAKELOCK = - MAX_NETWORK_STATE_TRACKER_EVENT + 8; + private static final int EVENT_CLEAR_NET_TRANSITION_WAKELOCK = 8; /** * used internally to reload global proxy settings */ - private static final int EVENT_APPLY_GLOBAL_HTTP_PROXY = - MAX_NETWORK_STATE_TRACKER_EVENT + 9; + private static final int EVENT_APPLY_GLOBAL_HTTP_PROXY = 9; /** * used internally to set external dependency met/unmet * arg1 = ENABLED (met) or DISABLED (unmet) * arg2 = NetworkType */ - private static final int EVENT_SET_DEPENDENCY_MET = - MAX_NETWORK_STATE_TRACKER_EVENT + 10; + private static final int EVENT_SET_DEPENDENCY_MET = 10; /** * used internally to restore DNS properties back to the * default network */ - private static final int EVENT_RESTORE_DNS = - MAX_NETWORK_STATE_TRACKER_EVENT + 11; + private static final int EVENT_RESTORE_DNS = 11; /** * used internally to send a sticky broadcast delayed. */ - private static final int EVENT_SEND_STICKY_BROADCAST_INTENT = - MAX_NETWORK_STATE_TRACKER_EVENT + 12; + private static final int EVENT_SEND_STICKY_BROADCAST_INTENT = 12; /** * Used internally to * {@link NetworkStateTracker#setPolicyDataEnable(boolean)}. */ - private static final int EVENT_SET_POLICY_DATA_ENABLE = MAX_NETWORK_STATE_TRACKER_EVENT + 13; + private static final int EVENT_SET_POLICY_DATA_ENABLE = 13; - private Handler mHandler; + /** Handler used for internal events. */ + private InternalHandler mHandler; + /** Handler used for incoming {@link NetworkStateTracker} events. */ + private NetworkStateTrackerHandler mTrackerHandler; // list of DeathRecipients used to make sure features are turned off when // a process dies @@ -334,7 +320,8 @@ public class ConnectivityService extends IConnectivityManager.Stub { HandlerThread handlerThread = new HandlerThread("ConnectivityServiceThread"); handlerThread.start(); - mHandler = new MyHandler(handlerThread.getLooper()); + mHandler = new InternalHandler(handlerThread.getLooper()); + mTrackerHandler = new NetworkStateTrackerHandler(handlerThread.getLooper()); // setup our unique device name if (TextUtils.isEmpty(SystemProperties.get("net.hostname"))) { @@ -484,33 +471,33 @@ public class ConnectivityService extends IConnectivityManager.Stub { for (int netType : mPriorityList) { switch (mNetConfigs[netType].radio) { case ConnectivityManager.TYPE_WIFI: - mNetTrackers[netType] = new WifiStateTracker(netType, - mNetConfigs[netType].name); - mNetTrackers[netType].startMonitoring(context, mHandler); - break; + mNetTrackers[netType] = new WifiStateTracker( + netType, mNetConfigs[netType].name); + mNetTrackers[netType].startMonitoring(context, mTrackerHandler); + break; case ConnectivityManager.TYPE_MOBILE: mNetTrackers[netType] = new MobileDataStateTracker(netType, mNetConfigs[netType].name); - mNetTrackers[netType].startMonitoring(context, mHandler); + mNetTrackers[netType].startMonitoring(context, mTrackerHandler); break; case ConnectivityManager.TYPE_DUMMY: mNetTrackers[netType] = new DummyDataStateTracker(netType, mNetConfigs[netType].name); - mNetTrackers[netType].startMonitoring(context, mHandler); + mNetTrackers[netType].startMonitoring(context, mTrackerHandler); break; case ConnectivityManager.TYPE_BLUETOOTH: mNetTrackers[netType] = BluetoothTetheringDataTracker.getInstance(); - mNetTrackers[netType].startMonitoring(context, mHandler); + mNetTrackers[netType].startMonitoring(context, mTrackerHandler); break; case ConnectivityManager.TYPE_WIMAX: mNetTrackers[netType] = makeWimaxStateTracker(); if (mNetTrackers[netType]!= null) { - mNetTrackers[netType].startMonitoring(context, mHandler); + mNetTrackers[netType].startMonitoring(context, mTrackerHandler); } break; case ConnectivityManager.TYPE_ETHERNET: mNetTrackers[netType] = EthernetDataTracker.getInstance(); - mNetTrackers[netType].startMonitoring(context, mHandler); + mNetTrackers[netType].startMonitoring(context, mTrackerHandler); break; default: loge("Trying to create a DataStateTracker for an unknown radio type " + @@ -557,8 +544,9 @@ public class ConnectivityService extends IConnectivityManager.Stub { loadGlobalProxy(); } -private NetworkStateTracker makeWimaxStateTracker() { - //Initialize Wimax + + private NetworkStateTracker makeWimaxStateTracker() { + // Initialize Wimax DexClassLoader wimaxClassLoader; Class wimaxStateTrackerClass = null; Class wimaxServiceClass = null; @@ -611,7 +599,7 @@ private NetworkStateTracker makeWimaxStateTracker() { Constructor wmxStTrkrConst = wimaxStateTrackerClass.getConstructor (new Class[] {Context.class, Handler.class}); wimaxStateTracker = (NetworkStateTracker)wmxStTrkrConst.newInstance(mContext, - mHandler); + mTrackerHandler); Constructor wmxSrvConst = wimaxServiceClass.getDeclaredConstructor (new Class[] {Context.class, wimaxStateTrackerClass}); @@ -632,6 +620,7 @@ private NetworkStateTracker makeWimaxStateTracker() { return wimaxStateTracker; } + /** * Sets the preferred network. * @param preference the new preference @@ -639,7 +628,8 @@ private NetworkStateTracker makeWimaxStateTracker() { public void setNetworkPreference(int preference) { enforceChangePermission(); - mHandler.sendMessage(mHandler.obtainMessage(EVENT_SET_NETWORK_PREFERENCE, preference, 0)); + mHandler.sendMessage( + mHandler.obtainMessage(EVENT_SET_NETWORK_PREFERENCE, preference, 0)); } public int getNetworkPreference() { @@ -2460,8 +2450,8 @@ private NetworkStateTracker makeWimaxStateTracker() { } // must be stateless - things change under us. - private class MyHandler extends Handler { - public MyHandler(Looper looper) { + private class NetworkStateTrackerHandler extends Handler { + public NetworkStateTrackerHandler(Looper looper) { super(looper); } @@ -2519,6 +2509,19 @@ private NetworkStateTracker makeWimaxStateTracker() { // @see bug/4455071 handleConnectivityChange(info.getType(), false); break; + } + } + } + + private class InternalHandler extends Handler { + public InternalHandler(Looper looper) { + super(looper); + } + + @Override + public void handleMessage(Message msg) { + NetworkInfo info; + switch (msg.what) { case EVENT_CLEAR_NET_TRANSITION_WAKELOCK: String causedBy = null; synchronized (ConnectivityService.this) { |