Merge branch 'ics-mr1-plus-aosp' of ssh://android-git:29418/platform/frameworks/base into ics-mr1-plus-aosp
This commit is contained in:
@ -42,6 +42,7 @@
|
|||||||
#include <surfaceflinger/ISurfaceComposerClient.h>
|
#include <surfaceflinger/ISurfaceComposerClient.h>
|
||||||
|
|
||||||
#include <core/SkBitmap.h>
|
#include <core/SkBitmap.h>
|
||||||
|
#include <core/SkStream.h>
|
||||||
#include <images/SkImageDecoder.h>
|
#include <images/SkImageDecoder.h>
|
||||||
|
|
||||||
#include <GLES/gl.h>
|
#include <GLES/gl.h>
|
||||||
@ -150,9 +151,15 @@ status_t BootAnimation::initTexture(void* buffer, size_t len)
|
|||||||
//StopWatch watch("blah");
|
//StopWatch watch("blah");
|
||||||
|
|
||||||
SkBitmap bitmap;
|
SkBitmap bitmap;
|
||||||
SkImageDecoder::DecodeMemory(buffer, len,
|
SkMemoryStream stream(buffer, len);
|
||||||
&bitmap, SkBitmap::kRGB_565_Config,
|
SkImageDecoder* codec = SkImageDecoder::Factory(&stream);
|
||||||
SkImageDecoder::kDecodePixels_Mode);
|
codec->setDitherImage(false);
|
||||||
|
if (codec) {
|
||||||
|
codec->decode(&stream, &bitmap,
|
||||||
|
SkBitmap::kRGB_565_Config,
|
||||||
|
SkImageDecoder::kDecodePixels_Mode);
|
||||||
|
delete codec;
|
||||||
|
}
|
||||||
|
|
||||||
// ensure we can call getPixels(). No need to call unlock, since the
|
// ensure we can call getPixels(). No need to call unlock, since the
|
||||||
// bitmap will go out of scope when we return from this method.
|
// bitmap will go out of scope when we return from this method.
|
||||||
|
@ -657,6 +657,15 @@ public class LayoutTransition {
|
|||||||
*/
|
*/
|
||||||
private void setupChangeAnimation(final ViewGroup parent, final int changeReason,
|
private void setupChangeAnimation(final ViewGroup parent, final int changeReason,
|
||||||
Animator baseAnimator, final long duration, final View child) {
|
Animator baseAnimator, final long duration, final View child) {
|
||||||
|
|
||||||
|
// If we already have a listener for this child, then we've already set up the
|
||||||
|
// changing animation we need. Multiple calls for a child may occur when several
|
||||||
|
// add/remove operations are run at once on a container; each one will trigger
|
||||||
|
// changes for the existing children in the container.
|
||||||
|
if (layoutChangeListenerMap.get(child) != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Make a copy of the appropriate animation
|
// Make a copy of the appropriate animation
|
||||||
final Animator anim = baseAnimator.clone();
|
final Animator anim = baseAnimator.clone();
|
||||||
|
|
||||||
|
@ -212,7 +212,11 @@ public class WallpaperManager {
|
|||||||
*/
|
*/
|
||||||
mHandler.sendEmptyMessage(MSG_CLEAR_WALLPAPER);
|
mHandler.sendEmptyMessage(MSG_CLEAR_WALLPAPER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Handler getHandler() {
|
||||||
|
return mHandler;
|
||||||
|
}
|
||||||
|
|
||||||
public Bitmap peekWallpaperBitmap(Context context, boolean returnDefault) {
|
public Bitmap peekWallpaperBitmap(Context context, boolean returnDefault) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (mWallpaper != null) {
|
if (mWallpaper != null) {
|
||||||
@ -604,7 +608,7 @@ public class WallpaperManager {
|
|||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the position of the current wallpaper within any larger space, when
|
* Set the position of the current wallpaper within any larger space, when
|
||||||
* that wallpaper is visible behind the given window. The X and Y offsets
|
* that wallpaper is visible behind the given window. The X and Y offsets
|
||||||
@ -619,16 +623,23 @@ public class WallpaperManager {
|
|||||||
* @param yOffset The offset along the Y dimension, from 0 to 1.
|
* @param yOffset The offset along the Y dimension, from 0 to 1.
|
||||||
*/
|
*/
|
||||||
public void setWallpaperOffsets(IBinder windowToken, float xOffset, float yOffset) {
|
public void setWallpaperOffsets(IBinder windowToken, float xOffset, float yOffset) {
|
||||||
try {
|
final IBinder fWindowToken = windowToken;
|
||||||
//Log.v(TAG, "Sending new wallpaper offsets from app...");
|
final float fXOffset = xOffset;
|
||||||
ViewRootImpl.getWindowSession(mContext.getMainLooper()).setWallpaperPosition(
|
final float fYOffset = yOffset;
|
||||||
windowToken, xOffset, yOffset, mWallpaperXStep, mWallpaperYStep);
|
sGlobals.getHandler().post(new Runnable() {
|
||||||
//Log.v(TAG, "...app returning after sending offsets!");
|
public void run() {
|
||||||
} catch (RemoteException e) {
|
try {
|
||||||
// Ignore.
|
//Log.v(TAG, "Sending new wallpaper offsets from app...");
|
||||||
}
|
ViewRootImpl.getWindowSession(mContext.getMainLooper()).setWallpaperPosition(
|
||||||
|
fWindowToken, fXOffset, fYOffset, mWallpaperXStep, mWallpaperYStep);
|
||||||
|
//Log.v(TAG, "...app returning after sending offsets!");
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
// Ignore.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For applications that use multiple virtual screens showing a wallpaper,
|
* For applications that use multiple virtual screens showing a wallpaper,
|
||||||
* specify the step size between virtual screens. For example, if the
|
* specify the step size between virtual screens. For example, if the
|
||||||
|
@ -464,6 +464,19 @@ public class NetworkStats implements Parcelable {
|
|||||||
* time, and that none of them have disappeared.
|
* time, and that none of them have disappeared.
|
||||||
*/
|
*/
|
||||||
public NetworkStats subtract(NetworkStats value) throws NonMonotonicException {
|
public NetworkStats subtract(NetworkStats value) throws NonMonotonicException {
|
||||||
|
return subtract(value, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subtract the given {@link NetworkStats}, effectively leaving the delta
|
||||||
|
* between two snapshots in time. Assumes that statistics rows collect over
|
||||||
|
* time, and that none of them have disappeared.
|
||||||
|
*
|
||||||
|
* @param clampNonMonotonic When non-monotonic stats are found, just clamp
|
||||||
|
* to 0 instead of throwing {@link NonMonotonicException}.
|
||||||
|
*/
|
||||||
|
public NetworkStats subtract(NetworkStats value, boolean clampNonMonotonic)
|
||||||
|
throws NonMonotonicException {
|
||||||
final long deltaRealtime = this.elapsedRealtime - value.elapsedRealtime;
|
final long deltaRealtime = this.elapsedRealtime - value.elapsedRealtime;
|
||||||
if (deltaRealtime < 0) {
|
if (deltaRealtime < 0) {
|
||||||
throw new NonMonotonicException(this, value);
|
throw new NonMonotonicException(this, value);
|
||||||
@ -497,7 +510,15 @@ public class NetworkStats implements Parcelable {
|
|||||||
|
|
||||||
if (entry.rxBytes < 0 || entry.rxPackets < 0 || entry.txBytes < 0
|
if (entry.rxBytes < 0 || entry.rxPackets < 0 || entry.txBytes < 0
|
||||||
|| entry.txPackets < 0 || entry.operations < 0) {
|
|| entry.txPackets < 0 || entry.operations < 0) {
|
||||||
throw new NonMonotonicException(this, i, value, j);
|
if (clampNonMonotonic) {
|
||||||
|
entry.rxBytes = Math.max(entry.rxBytes, 0);
|
||||||
|
entry.rxPackets = Math.max(entry.rxPackets, 0);
|
||||||
|
entry.txBytes = Math.max(entry.txBytes, 0);
|
||||||
|
entry.txPackets = Math.max(entry.txPackets, 0);
|
||||||
|
entry.operations = Math.max(entry.operations, 0);
|
||||||
|
} else {
|
||||||
|
throw new NonMonotonicException(this, i, value, j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,6 +315,27 @@ class GLES20Canvas extends HardwareCanvas {
|
|||||||
|
|
||||||
private static native void nFlushCaches(int level);
|
private static native void nFlushCaches(int level);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release all resources associated with the underlying caches. This should
|
||||||
|
* only be called after a full flushCaches().
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static void terminateCaches() {
|
||||||
|
nTerminateCaches();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static native void nTerminateCaches();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static void initCaches() {
|
||||||
|
nInitCaches();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static native void nInitCaches();
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// Display list
|
// Display list
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -25,6 +25,7 @@ import android.opengl.GLUtils;
|
|||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import com.google.android.gles_jni.EGLImpl;
|
||||||
|
|
||||||
import javax.microedition.khronos.egl.EGL10;
|
import javax.microedition.khronos.egl.EGL10;
|
||||||
import javax.microedition.khronos.egl.EGL11;
|
import javax.microedition.khronos.egl.EGL11;
|
||||||
@ -343,6 +344,15 @@ public abstract class HardwareRenderer {
|
|||||||
Gl20Renderer.trimMemory(level);
|
Gl20Renderer.trimMemory(level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoke this method when the system needs to clean up all resources
|
||||||
|
* associated with hardware rendering.
|
||||||
|
*/
|
||||||
|
static void terminate() {
|
||||||
|
Log.d(LOG_TAG, "Terminating hardware rendering");
|
||||||
|
Gl20Renderer.terminate();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether hardware acceleration is currently enabled.
|
* Indicates whether hardware acceleration is currently enabled.
|
||||||
*
|
*
|
||||||
@ -651,6 +661,8 @@ public abstract class HardwareRenderer {
|
|||||||
throw new Surface.OutOfResourcesException("eglMakeCurrent failed "
|
throw new Surface.OutOfResourcesException("eglMakeCurrent failed "
|
||||||
+ GLUtils.getEGLErrorString(sEgl.eglGetError()));
|
+ GLUtils.getEGLErrorString(sEgl.eglGetError()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initCaches();
|
||||||
|
|
||||||
// If mDirtyRegions is set, this means we have an EGL configuration
|
// If mDirtyRegions is set, this means we have an EGL configuration
|
||||||
// with EGL_SWAP_BEHAVIOR_PRESERVED_BIT set
|
// with EGL_SWAP_BEHAVIOR_PRESERVED_BIT set
|
||||||
@ -671,6 +683,8 @@ public abstract class HardwareRenderer {
|
|||||||
return mEglContext.getGL();
|
return mEglContext.getGL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract void initCaches();
|
||||||
|
|
||||||
EGLContext createContext(EGL10 egl, EGLDisplay eglDisplay, EGLConfig eglConfig) {
|
EGLContext createContext(EGL10 egl, EGLDisplay eglDisplay, EGLConfig eglConfig) {
|
||||||
int[] attribs = { EGL_CONTEXT_CLIENT_VERSION, mGlVersion, EGL_NONE };
|
int[] attribs = { EGL_CONTEXT_CLIENT_VERSION, mGlVersion, EGL_NONE };
|
||||||
|
|
||||||
@ -914,6 +928,11 @@ public abstract class HardwareRenderer {
|
|||||||
EGL_NONE
|
EGL_NONE
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void initCaches() {
|
||||||
|
GLES20Canvas.initCaches();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean canDraw() {
|
boolean canDraw() {
|
||||||
@ -1006,16 +1025,7 @@ public abstract class HardwareRenderer {
|
|||||||
if (eglContext == null) {
|
if (eglContext == null) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
synchronized (sPbufferLock) {
|
usePbufferSurface(eglContext);
|
||||||
// Create a temporary 1x1 pbuffer so we have a context
|
|
||||||
// to clear our OpenGL objects
|
|
||||||
if (sPbuffer == null) {
|
|
||||||
sPbuffer = sEgl.eglCreatePbufferSurface(sEglDisplay, sEglConfig, new int[] {
|
|
||||||
EGL_WIDTH, 1, EGL_HEIGHT, 1, EGL_NONE
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sEgl.eglMakeCurrent(sEglDisplay, sPbuffer, sPbuffer, eglContext);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (level) {
|
switch (level) {
|
||||||
@ -1029,5 +1039,46 @@ public abstract class HardwareRenderer {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void usePbufferSurface(EGLContext eglContext) {
|
||||||
|
synchronized (sPbufferLock) {
|
||||||
|
// Create a temporary 1x1 pbuffer so we have a context
|
||||||
|
// to clear our OpenGL objects
|
||||||
|
if (sPbuffer == null) {
|
||||||
|
sPbuffer = sEgl.eglCreatePbufferSurface(sEglDisplay, sEglConfig, new int[] {
|
||||||
|
EGL_WIDTH, 1, EGL_HEIGHT, 1, EGL_NONE
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sEgl.eglMakeCurrent(sEglDisplay, sPbuffer, sPbuffer, eglContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void terminate() {
|
||||||
|
synchronized (sEglLock) {
|
||||||
|
if (sEgl == null) return;
|
||||||
|
|
||||||
|
if (EGLImpl.getInitCount(sEglDisplay) == 1) {
|
||||||
|
EGLContext eglContext = sEglContextStorage.get();
|
||||||
|
if (eglContext == null) return;
|
||||||
|
|
||||||
|
usePbufferSurface(eglContext);
|
||||||
|
GLES20Canvas.terminateCaches();
|
||||||
|
|
||||||
|
sEgl.eglDestroyContext(sEglDisplay, eglContext);
|
||||||
|
sEglContextStorage.remove();
|
||||||
|
|
||||||
|
sEgl.eglDestroySurface(sEglDisplay, sPbuffer);
|
||||||
|
sEgl.eglMakeCurrent(sEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
|
|
||||||
|
sEgl.eglReleaseThread();
|
||||||
|
sEgl.eglTerminate(sEglDisplay);
|
||||||
|
|
||||||
|
sEgl = null;
|
||||||
|
sEglDisplay = null;
|
||||||
|
sEglConfig = null;
|
||||||
|
sPbuffer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -567,7 +567,7 @@ public final class ViewRootImpl extends Handler implements ViewParent,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void destroyHardwareResources() {
|
void destroyHardwareResources() {
|
||||||
if (mAttachInfo.mHardwareRenderer != null) {
|
if (mAttachInfo.mHardwareRenderer != null) {
|
||||||
if (mAttachInfo.mHardwareRenderer.isEnabled()) {
|
if (mAttachInfo.mHardwareRenderer.isEnabled()) {
|
||||||
mAttachInfo.mHardwareRenderer.destroyLayers(mView);
|
mAttachInfo.mHardwareRenderer.destroyLayers(mView);
|
||||||
@ -880,12 +880,10 @@ public final class ViewRootImpl extends Handler implements ViewParent,
|
|||||||
|| mNewSurfaceNeeded;
|
|| mNewSurfaceNeeded;
|
||||||
|
|
||||||
WindowManager.LayoutParams params = null;
|
WindowManager.LayoutParams params = null;
|
||||||
int windowAttributesChanges = 0;
|
|
||||||
if (mWindowAttributesChanged) {
|
if (mWindowAttributesChanged) {
|
||||||
mWindowAttributesChanged = false;
|
mWindowAttributesChanged = false;
|
||||||
surfaceChanged = true;
|
surfaceChanged = true;
|
||||||
params = lp;
|
params = lp;
|
||||||
windowAttributesChanges = mWindowAttributesChangesFlag;
|
|
||||||
}
|
}
|
||||||
CompatibilityInfo compatibilityInfo = mCompatibilityInfo.get();
|
CompatibilityInfo compatibilityInfo = mCompatibilityInfo.get();
|
||||||
if (compatibilityInfo.supportsScreen() == mLastInCompatMode) {
|
if (compatibilityInfo.supportsScreen() == mLastInCompatMode) {
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package android.view;
|
package android.view;
|
||||||
|
|
||||||
|
import android.app.ActivityManager;
|
||||||
|
import android.content.ComponentCallbacks2;
|
||||||
import android.content.res.CompatibilityInfo;
|
import android.content.res.CompatibilityInfo;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.graphics.PixelFormat;
|
import android.graphics.PixelFormat;
|
||||||
@ -409,7 +411,30 @@ public class WindowManagerImpl implements WindowManager {
|
|||||||
*/
|
*/
|
||||||
public void trimMemory(int level) {
|
public void trimMemory(int level) {
|
||||||
if (HardwareRenderer.isAvailable()) {
|
if (HardwareRenderer.isAvailable()) {
|
||||||
HardwareRenderer.trimMemory(level);
|
switch (level) {
|
||||||
|
case ComponentCallbacks2.TRIM_MEMORY_COMPLETE:
|
||||||
|
case ComponentCallbacks2.TRIM_MEMORY_MODERATE:
|
||||||
|
// On low and medium end gfx devices
|
||||||
|
if (!ActivityManager.isHighEndGfx(getDefaultDisplay())) {
|
||||||
|
// Force a full memory flush
|
||||||
|
HardwareRenderer.trimMemory(ComponentCallbacks2.TRIM_MEMORY_COMPLETE);
|
||||||
|
// Destroy all hardware surfaces and resources associated to
|
||||||
|
// known windows
|
||||||
|
synchronized (this) {
|
||||||
|
if (mViews == null) return;
|
||||||
|
int count = mViews.length;
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
mRoots[i].destroyHardwareResources();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Terminate the hardware renderer to free all resources
|
||||||
|
HardwareRenderer.terminate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// high end gfx devices fall through to next case
|
||||||
|
default:
|
||||||
|
HardwareRenderer.trimMemory(level);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2861,8 +2861,8 @@ public class WebView extends AbsoluteLayout
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Used to avoid sending many visible rect messages.
|
// Used to avoid sending many visible rect messages.
|
||||||
private Rect mLastVisibleRectSent;
|
private Rect mLastVisibleRectSent = new Rect();
|
||||||
private Rect mLastGlobalRect;
|
private Rect mLastGlobalRect = new Rect();
|
||||||
private Rect mVisibleRect = new Rect();
|
private Rect mVisibleRect = new Rect();
|
||||||
private Rect mGlobalVisibleRect = new Rect();
|
private Rect mGlobalVisibleRect = new Rect();
|
||||||
private Point mScrollOffset = new Point();
|
private Point mScrollOffset = new Point();
|
||||||
@ -2878,7 +2878,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
mWebViewCore.sendMessage(EventHub.SET_SCROLL_OFFSET,
|
mWebViewCore.sendMessage(EventHub.SET_SCROLL_OFFSET,
|
||||||
nativeMoveGeneration(), mSendScrollEvent ? 1 : 0, mScrollOffset);
|
nativeMoveGeneration(), mSendScrollEvent ? 1 : 0, mScrollOffset);
|
||||||
}
|
}
|
||||||
mLastVisibleRectSent = mVisibleRect;
|
mLastVisibleRectSent.set(mVisibleRect);
|
||||||
mPrivateHandler.removeMessages(SWITCH_TO_LONGPRESS);
|
mPrivateHandler.removeMessages(SWITCH_TO_LONGPRESS);
|
||||||
}
|
}
|
||||||
if (getGlobalVisibleRect(mGlobalVisibleRect)
|
if (getGlobalVisibleRect(mGlobalVisibleRect)
|
||||||
@ -2894,7 +2894,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
if (!mBlockWebkitViewMessages) {
|
if (!mBlockWebkitViewMessages) {
|
||||||
mWebViewCore.sendMessage(EventHub.SET_GLOBAL_BOUNDS, mGlobalVisibleRect);
|
mWebViewCore.sendMessage(EventHub.SET_GLOBAL_BOUNDS, mGlobalVisibleRect);
|
||||||
}
|
}
|
||||||
mLastGlobalRect = mGlobalVisibleRect;
|
mLastGlobalRect.set(mGlobalVisibleRect);
|
||||||
}
|
}
|
||||||
return mVisibleRect;
|
return mVisibleRect;
|
||||||
}
|
}
|
||||||
|
@ -1036,6 +1036,7 @@ public class ImageView extends View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RemotableViewMethod
|
||||||
@Override
|
@Override
|
||||||
public void setVisibility(int visibility) {
|
public void setVisibility(int visibility) {
|
||||||
super.setVisibility(visibility);
|
super.setVisibility(visibility);
|
||||||
|
@ -1248,6 +1248,8 @@ public class PopupWindow {
|
|||||||
*/
|
*/
|
||||||
public void dismiss() {
|
public void dismiss() {
|
||||||
if (isShowing() && mPopupView != null) {
|
if (isShowing() && mPopupView != null) {
|
||||||
|
mIsShowing = false;
|
||||||
|
|
||||||
unregisterForScrollChanged();
|
unregisterForScrollChanged();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -1257,7 +1259,6 @@ public class PopupWindow {
|
|||||||
((ViewGroup) mPopupView).removeView(mContentView);
|
((ViewGroup) mPopupView).removeView(mContentView);
|
||||||
}
|
}
|
||||||
mPopupView = null;
|
mPopupView = null;
|
||||||
mIsShowing = false;
|
|
||||||
|
|
||||||
if (mOnDismissListener != null) {
|
if (mOnDismissListener != null) {
|
||||||
mOnDismissListener.onDismiss();
|
mOnDismissListener.onDismiss();
|
||||||
|
@ -149,7 +149,7 @@ static jint android_nfc_NdefRecord_parseNdefRecord(JNIEnv *e, jobject o,
|
|||||||
|
|
||||||
/* Set flags field */
|
/* Set flags field */
|
||||||
mFlags = e->GetFieldID(record_cls, "mFlags", "B");
|
mFlags = e->GetFieldID(record_cls, "mFlags", "B");
|
||||||
e->SetIntField(o, mFlags, record.Flags);
|
e->SetByteField(o, mFlags, record.Flags);
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
|
@ -134,6 +134,18 @@ static void android_view_GLES20Canvas_flushCaches(JNIEnv* env, jobject clazz,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void android_view_GLES20Canvas_initCaches(JNIEnv* env, jobject clazz) {
|
||||||
|
if (Caches::hasInstance()) {
|
||||||
|
Caches::getInstance().init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void android_view_GLES20Canvas_terminateCaches(JNIEnv* env, jobject clazz) {
|
||||||
|
if (Caches::hasInstance()) {
|
||||||
|
Caches::getInstance().terminate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Constructors
|
// Constructors
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -756,6 +768,8 @@ static JNINativeMethod gMethods[] = {
|
|||||||
{ "nPreserveBackBuffer", "()Z", (void*) android_view_GLES20Canvas_preserveBackBuffer },
|
{ "nPreserveBackBuffer", "()Z", (void*) android_view_GLES20Canvas_preserveBackBuffer },
|
||||||
{ "nDisableVsync", "()V", (void*) android_view_GLES20Canvas_disableVsync },
|
{ "nDisableVsync", "()V", (void*) android_view_GLES20Canvas_disableVsync },
|
||||||
{ "nFlushCaches", "(I)V", (void*) android_view_GLES20Canvas_flushCaches },
|
{ "nFlushCaches", "(I)V", (void*) android_view_GLES20Canvas_flushCaches },
|
||||||
|
{ "nInitCaches", "()V", (void*) android_view_GLES20Canvas_initCaches },
|
||||||
|
{ "nTerminateCaches", "()V", (void*) android_view_GLES20Canvas_terminateCaches },
|
||||||
|
|
||||||
{ "nCreateRenderer", "()I", (void*) android_view_GLES20Canvas_createRenderer },
|
{ "nCreateRenderer", "()I", (void*) android_view_GLES20Canvas_createRenderer },
|
||||||
{ "nDestroyRenderer", "(I)V", (void*) android_view_GLES20Canvas_destroyRenderer },
|
{ "nDestroyRenderer", "(I)V", (void*) android_view_GLES20Canvas_destroyRenderer },
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
#include <GLES/gl.h>
|
#include <GLES/gl.h>
|
||||||
|
|
||||||
|
#include <EGL/egl_display.h>
|
||||||
|
|
||||||
#include <surfaceflinger/Surface.h>
|
#include <surfaceflinger/Surface.h>
|
||||||
#include <SkBitmap.h>
|
#include <SkBitmap.h>
|
||||||
#include <SkPixelRef.h>
|
#include <SkPixelRef.h>
|
||||||
@ -173,6 +175,16 @@ static jboolean jni_eglQuerySurface(JNIEnv *_env, jobject _this, jobject display
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static jint jni_getInitCount(JNIEnv *_env, jobject _clazz, jobject display) {
|
||||||
|
EGLDisplay dpy = getDisplay(_env, display);
|
||||||
|
egl_display_t* eglDisplay = get_display(dpy);
|
||||||
|
return eglDisplay ? eglDisplay->getRefsCount() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static jboolean jni_eglReleaseThread(JNIEnv *_env, jobject _this) {
|
||||||
|
return eglReleaseThread();
|
||||||
|
}
|
||||||
|
|
||||||
static jboolean jni_eglChooseConfig(JNIEnv *_env, jobject _this, jobject display,
|
static jboolean jni_eglChooseConfig(JNIEnv *_env, jobject _this, jobject display,
|
||||||
jintArray attrib_list, jobjectArray configs, jint config_size, jintArray num_config) {
|
jintArray attrib_list, jobjectArray configs, jint config_size, jintArray num_config) {
|
||||||
if (display == NULL
|
if (display == NULL
|
||||||
@ -526,6 +538,8 @@ static JNINativeMethod methods[] = {
|
|||||||
{"eglInitialize", "(" DISPLAY "[I)Z", (void*)jni_eglInitialize },
|
{"eglInitialize", "(" DISPLAY "[I)Z", (void*)jni_eglInitialize },
|
||||||
{"eglQueryContext", "(" DISPLAY CONTEXT "I[I)Z", (void*)jni_eglQueryContext },
|
{"eglQueryContext", "(" DISPLAY CONTEXT "I[I)Z", (void*)jni_eglQueryContext },
|
||||||
{"eglQuerySurface", "(" DISPLAY SURFACE "I[I)Z", (void*)jni_eglQuerySurface },
|
{"eglQuerySurface", "(" DISPLAY SURFACE "I[I)Z", (void*)jni_eglQuerySurface },
|
||||||
|
{"eglReleaseThread","()Z", (void*)jni_eglReleaseThread },
|
||||||
|
{"getInitCount", "(" DISPLAY ")I", (void*)jni_getInitCount },
|
||||||
{"eglChooseConfig", "(" DISPLAY "[I[" CONFIG "I[I)Z", (void*)jni_eglChooseConfig },
|
{"eglChooseConfig", "(" DISPLAY "[I[" CONFIG "I[I)Z", (void*)jni_eglChooseConfig },
|
||||||
{"_eglCreateContext","(" DISPLAY CONFIG CONTEXT "[I)I", (void*)jni_eglCreateContext },
|
{"_eglCreateContext","(" DISPLAY CONFIG CONTEXT "[I)I", (void*)jni_eglCreateContext },
|
||||||
{"eglGetConfigs", "(" DISPLAY "[" CONFIG "I[I)Z", (void*)jni_eglGetConfigs },
|
{"eglGetConfigs", "(" DISPLAY "[" CONFIG "I[I)Z", (void*)jni_eglGetConfigs },
|
||||||
|
@ -46,22 +46,16 @@ namespace uirenderer {
|
|||||||
// Constructors/destructor
|
// Constructors/destructor
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
Caches::Caches(): Singleton<Caches>(), blend(false), lastSrcMode(GL_ZERO),
|
Caches::Caches(): Singleton<Caches>(), mInitialized(false) {
|
||||||
lastDstMode(GL_ZERO), currentProgram(NULL) {
|
|
||||||
GLint maxTextureUnits;
|
GLint maxTextureUnits;
|
||||||
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxTextureUnits);
|
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxTextureUnits);
|
||||||
if (maxTextureUnits < REQUIRED_TEXTURE_UNITS_COUNT) {
|
if (maxTextureUnits < REQUIRED_TEXTURE_UNITS_COUNT) {
|
||||||
LOGW("At least %d texture units are required!", REQUIRED_TEXTURE_UNITS_COUNT);
|
LOGW("At least %d texture units are required!", REQUIRED_TEXTURE_UNITS_COUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
glGenBuffers(1, &meshBuffer);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, meshBuffer);
|
|
||||||
glBufferData(GL_ARRAY_BUFFER, sizeof(gMeshVertices), gMeshVertices, GL_STATIC_DRAW);
|
|
||||||
|
|
||||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
|
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
|
||||||
|
|
||||||
mCurrentBuffer = meshBuffer;
|
init();
|
||||||
mRegionMesh = NULL;
|
|
||||||
|
|
||||||
mDebugLevel = readDebugLevel();
|
mDebugLevel = readDebugLevel();
|
||||||
LOGD("Enabling debug mode %d", mDebugLevel);
|
LOGD("Enabling debug mode %d", mDebugLevel);
|
||||||
@ -71,8 +65,40 @@ Caches::Caches(): Singleton<Caches>(), blend(false), lastSrcMode(GL_ZERO),
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Caches::~Caches() {
|
void Caches::init() {
|
||||||
|
if (mInitialized) return;
|
||||||
|
|
||||||
|
glGenBuffers(1, &meshBuffer);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, meshBuffer);
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, sizeof(gMeshVertices), gMeshVertices, GL_STATIC_DRAW);
|
||||||
|
|
||||||
|
mCurrentBuffer = meshBuffer;
|
||||||
|
mRegionMesh = NULL;
|
||||||
|
|
||||||
|
blend = false;
|
||||||
|
lastSrcMode = GL_ZERO;
|
||||||
|
lastDstMode = GL_ZERO;
|
||||||
|
currentProgram = NULL;
|
||||||
|
|
||||||
|
mInitialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Caches::terminate() {
|
||||||
|
if (!mInitialized) return;
|
||||||
|
|
||||||
|
glDeleteBuffers(1, &meshBuffer);
|
||||||
|
mCurrentBuffer = 0;
|
||||||
|
|
||||||
|
glDeleteBuffers(1, &mRegionMeshIndices);
|
||||||
delete[] mRegionMesh;
|
delete[] mRegionMesh;
|
||||||
|
mRegionMesh = NULL;
|
||||||
|
|
||||||
|
fboCache.clear();
|
||||||
|
|
||||||
|
programCache.clear();
|
||||||
|
currentProgram = NULL;
|
||||||
|
|
||||||
|
mInitialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -86,7 +86,6 @@ struct CacheLogger {
|
|||||||
|
|
||||||
class ANDROID_API Caches: public Singleton<Caches> {
|
class ANDROID_API Caches: public Singleton<Caches> {
|
||||||
Caches();
|
Caches();
|
||||||
~Caches();
|
|
||||||
|
|
||||||
friend class Singleton<Caches>;
|
friend class Singleton<Caches>;
|
||||||
|
|
||||||
@ -108,6 +107,11 @@ public:
|
|||||||
kFlushMode_Full
|
kFlushMode_Full
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the cache.
|
||||||
|
*/
|
||||||
|
void init();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flush the cache.
|
* Flush the cache.
|
||||||
*
|
*
|
||||||
@ -115,6 +119,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
void flush(FlushMode mode);
|
void flush(FlushMode mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys all resources associated with this cache. This should
|
||||||
|
* be called after a flush(kFlushMode_Full).
|
||||||
|
*/
|
||||||
|
void terminate();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the renderer is in debug mode.
|
* Indicates whether the renderer is in debug mode.
|
||||||
* This debug mode provides limited information to app developers.
|
* This debug mode provides limited information to app developers.
|
||||||
@ -194,6 +204,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
DebugLevel mDebugLevel;
|
DebugLevel mDebugLevel;
|
||||||
|
bool mInitialized;
|
||||||
}; // class Caches
|
}; // class Caches
|
||||||
|
|
||||||
}; // namespace uirenderer
|
}; // namespace uirenderer
|
||||||
|
@ -314,6 +314,16 @@ class EGLLogWrapper implements EGL11 {
|
|||||||
checkError();
|
checkError();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide **/
|
||||||
|
public boolean eglReleaseThread() {
|
||||||
|
begin("eglReleaseThread");
|
||||||
|
end();
|
||||||
|
boolean result = mEgl10.eglReleaseThread();
|
||||||
|
returns(result);
|
||||||
|
checkError();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean eglSwapBuffers(EGLDisplay display, EGLSurface surface) {
|
public boolean eglSwapBuffers(EGLDisplay display, EGLSurface surface) {
|
||||||
begin("eglInitialize");
|
begin("eglInitialize");
|
||||||
|
@ -31,6 +31,8 @@ public class EGLImpl implements EGL10 {
|
|||||||
public native boolean eglInitialize(EGLDisplay display, int[] major_minor);
|
public native boolean eglInitialize(EGLDisplay display, int[] major_minor);
|
||||||
public native boolean eglQueryContext(EGLDisplay display, EGLContext context, int attribute, int[] value);
|
public native boolean eglQueryContext(EGLDisplay display, EGLContext context, int attribute, int[] value);
|
||||||
public native boolean eglQuerySurface(EGLDisplay display, EGLSurface surface, int attribute, int[] value);
|
public native boolean eglQuerySurface(EGLDisplay display, EGLSurface surface, int attribute, int[] value);
|
||||||
|
/** @hide **/
|
||||||
|
public native boolean eglReleaseThread();
|
||||||
public native boolean eglChooseConfig(EGLDisplay display, int[] attrib_list, EGLConfig[] configs, int config_size, int[] num_config);
|
public native boolean eglChooseConfig(EGLDisplay display, int[] attrib_list, EGLConfig[] configs, int config_size, int[] num_config);
|
||||||
public native boolean eglGetConfigAttrib(EGLDisplay display, EGLConfig config, int attribute, int[] value);
|
public native boolean eglGetConfigAttrib(EGLDisplay display, EGLConfig config, int attribute, int[] value);
|
||||||
public native boolean eglGetConfigs(EGLDisplay display, EGLConfig[] configs, int config_size, int[] num_config);
|
public native boolean eglGetConfigs(EGLDisplay display, EGLConfig[] configs, int config_size, int[] num_config);
|
||||||
@ -44,6 +46,9 @@ public class EGLImpl implements EGL10 {
|
|||||||
public native boolean eglCopyBuffers(EGLDisplay display, EGLSurface surface, Object native_pixmap);
|
public native boolean eglCopyBuffers(EGLDisplay display, EGLSurface surface, Object native_pixmap);
|
||||||
public native boolean eglWaitGL();
|
public native boolean eglWaitGL();
|
||||||
public native boolean eglWaitNative(int engine, Object bindTarget);
|
public native boolean eglWaitNative(int engine, Object bindTarget);
|
||||||
|
|
||||||
|
/** @hide **/
|
||||||
|
public static native int getInitCount(EGLDisplay display);
|
||||||
|
|
||||||
public EGLContext eglCreateContext(EGLDisplay display, EGLConfig config, EGLContext share_context, int[] attrib_list) {
|
public EGLContext eglCreateContext(EGLDisplay display, EGLConfig config, EGLContext share_context, int[] attrib_list) {
|
||||||
int eglContextId = _eglCreateContext(display, config, share_context, attrib_list);
|
int eglContextId = _eglCreateContext(display, config, share_context, attrib_list);
|
||||||
@ -85,7 +90,7 @@ public class EGLImpl implements EGL10 {
|
|||||||
eglSurfaceId = _eglCreateWindowSurface(display, config, sur, attrib_list);
|
eglSurfaceId = _eglCreateWindowSurface(display, config, sur, attrib_list);
|
||||||
} else if (native_window instanceof SurfaceTexture) {
|
} else if (native_window instanceof SurfaceTexture) {
|
||||||
eglSurfaceId = _eglCreateWindowSurfaceTexture(display, config,
|
eglSurfaceId = _eglCreateWindowSurfaceTexture(display, config,
|
||||||
(SurfaceTexture) native_window, attrib_list);
|
native_window, attrib_list);
|
||||||
} else {
|
} else {
|
||||||
throw new java.lang.UnsupportedOperationException(
|
throw new java.lang.UnsupportedOperationException(
|
||||||
"eglCreateWindowSurface() can only be called with an instance of " +
|
"eglCreateWindowSurface() can only be called with an instance of " +
|
||||||
|
@ -114,6 +114,8 @@ public interface EGL10 extends EGL {
|
|||||||
boolean eglQueryContext(EGLDisplay display, EGLContext context, int attribute, int[] value);
|
boolean eglQueryContext(EGLDisplay display, EGLContext context, int attribute, int[] value);
|
||||||
String eglQueryString(EGLDisplay display, int name);
|
String eglQueryString(EGLDisplay display, int name);
|
||||||
boolean eglQuerySurface(EGLDisplay display, EGLSurface surface, int attribute, int[] value);
|
boolean eglQuerySurface(EGLDisplay display, EGLSurface surface, int attribute, int[] value);
|
||||||
|
/** @hide **/
|
||||||
|
boolean eglReleaseThread();
|
||||||
boolean eglSwapBuffers(EGLDisplay display, EGLSurface surface);
|
boolean eglSwapBuffers(EGLDisplay display, EGLSurface surface);
|
||||||
boolean eglTerminate(EGLDisplay display);
|
boolean eglTerminate(EGLDisplay display);
|
||||||
boolean eglWaitGL();
|
boolean eglWaitGL();
|
||||||
|
@ -91,6 +91,8 @@ public:
|
|||||||
inline bool isValid() const { return magic == '_dpy'; }
|
inline bool isValid() const { return magic == '_dpy'; }
|
||||||
inline bool isAlive() const { return isValid(); }
|
inline bool isAlive() const { return isValid(); }
|
||||||
|
|
||||||
|
inline uint32_t getRefsCount() const { return refs; }
|
||||||
|
|
||||||
struct strings_t {
|
struct strings_t {
|
||||||
char const * vendor;
|
char const * vendor;
|
||||||
char const * version;
|
char const * version;
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:id="@+id/spacer"
|
android:id="@+id/spacer"
|
||||||
/>
|
/>
|
||||||
<FrameLayout
|
<!--<FrameLayout
|
||||||
android:id="@+id/wimax_combo"
|
android:id="@+id/wimax_combo"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -72,6 +72,7 @@
|
|||||||
android:layout_gravity="center|bottom"
|
android:layout_gravity="center|bottom"
|
||||||
/>
|
/>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
-->
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -257,10 +257,16 @@
|
|||||||
<string name="accessibility_wifi_three_bars">Wi-Fi three bars.</string>
|
<string name="accessibility_wifi_three_bars">Wi-Fi three bars.</string>
|
||||||
<!-- Content description of the WIFI signal when it is full for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
|
<!-- Content description of the WIFI signal when it is full for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_wifi_signal_full">WiFi signal full.</string>
|
<string name="accessibility_wifi_signal_full">WiFi signal full.</string>
|
||||||
|
|
||||||
|
<!-- Content description of the WiMAX signal when no signal for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_no_wimax">No WiMAX.</string>
|
<string name="accessibility_no_wimax">No WiMAX.</string>
|
||||||
|
<!-- Content description of the WiMAX signal when it is one bar for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_wimax_one_bar">WiMAX one bar.</string>
|
<string name="accessibility_wimax_one_bar">WiMAX one bar.</string>
|
||||||
|
<!-- Content description of the WiMAX signal when it is two bars for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_wimax_two_bars">WiMAX two bars.</string>
|
<string name="accessibility_wimax_two_bars">WiMAX two bars.</string>
|
||||||
|
<!-- Content description of the WiMAX signal when it is three bars for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_wimax_three_bars">WiMAX three bars.</string>
|
<string name="accessibility_wimax_three_bars">WiMAX three bars.</string>
|
||||||
|
<!-- Content description of the WiMAX signal when it is full for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_wimax_signal_full">WiMAX signal full.</string>
|
<string name="accessibility_wimax_signal_full">WiMAX signal full.</string>
|
||||||
|
|
||||||
<!-- Content description of the data connection type GPRS for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
|
<!-- Content description of the data connection type GPRS for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
|
||||||
|
@ -350,11 +350,11 @@ public class PhoneStatusBar extends StatusBar {
|
|||||||
(SignalClusterView)sb.findViewById(R.id.signal_cluster);
|
(SignalClusterView)sb.findViewById(R.id.signal_cluster);
|
||||||
mNetworkController.addSignalCluster(signalCluster);
|
mNetworkController.addSignalCluster(signalCluster);
|
||||||
signalCluster.setNetworkController(mNetworkController);
|
signalCluster.setNetworkController(mNetworkController);
|
||||||
final ImageView wimaxRSSI =
|
// final ImageView wimaxRSSI =
|
||||||
(ImageView)sb.findViewById(R.id.wimax_signal);
|
// (ImageView)sb.findViewById(R.id.wimax_signal);
|
||||||
if (wimaxRSSI != null) {
|
// if (wimaxRSSI != null) {
|
||||||
mNetworkController.addWimaxIconView(wimaxRSSI);
|
// mNetworkController.addWimaxIconView(wimaxRSSI);
|
||||||
}
|
// }
|
||||||
// Recents Panel
|
// Recents Panel
|
||||||
mRecentTasksLoader = new RecentTasksLoader(context);
|
mRecentTasksLoader = new RecentTasksLoader(context);
|
||||||
updateRecentsPanel();
|
updateRecentsPanel();
|
||||||
|
@ -111,6 +111,7 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
com.android.internal.R.drawable.stat_sys_tether_bluetooth;
|
com.android.internal.R.drawable.stat_sys_tether_bluetooth;
|
||||||
|
|
||||||
//wimax
|
//wimax
|
||||||
|
private boolean mWimaxSupported = false;
|
||||||
private boolean mIsWimaxEnabled = false;
|
private boolean mIsWimaxEnabled = false;
|
||||||
private boolean mWimaxConnected = false;
|
private boolean mWimaxConnected = false;
|
||||||
private boolean mWimaxIdle = false;
|
private boolean mWimaxIdle = false;
|
||||||
@ -213,9 +214,9 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
filter.addAction(ConnectivityManager.INET_CONDITION_ACTION);
|
filter.addAction(ConnectivityManager.INET_CONDITION_ACTION);
|
||||||
filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
|
filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
|
||||||
filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
|
filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
|
||||||
boolean isWimaxConfigEnabled = mContext.getResources().getBoolean(
|
mWimaxSupported = mContext.getResources().getBoolean(
|
||||||
com.android.internal.R.bool.config_wimaxEnabled);
|
com.android.internal.R.bool.config_wimaxEnabled);
|
||||||
if(isWimaxConfigEnabled) {
|
if(mWimaxSupported) {
|
||||||
filter.addAction(WimaxManagerConstants.WIMAX_NETWORK_STATE_CHANGED_ACTION);
|
filter.addAction(WimaxManagerConstants.WIMAX_NETWORK_STATE_CHANGED_ACTION);
|
||||||
filter.addAction(WimaxManagerConstants.SIGNAL_LEVEL_CHANGED_ACTION);
|
filter.addAction(WimaxManagerConstants.SIGNAL_LEVEL_CHANGED_ACTION);
|
||||||
filter.addAction(WimaxManagerConstants.NET_4G_STATE_CHANGED_ACTION);
|
filter.addAction(WimaxManagerConstants.NET_4G_STATE_CHANGED_ACTION);
|
||||||
@ -262,19 +263,36 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
|
|
||||||
public void addSignalCluster(SignalCluster cluster) {
|
public void addSignalCluster(SignalCluster cluster) {
|
||||||
mSignalClusters.add(cluster);
|
mSignalClusters.add(cluster);
|
||||||
|
refreshSignalCluster(cluster);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void refreshSignalCluster(SignalCluster cluster) {
|
||||||
cluster.setWifiIndicators(
|
cluster.setWifiIndicators(
|
||||||
mWifiConnected, // only show wifi in the cluster if connected
|
mWifiConnected, // only show wifi in the cluster if connected
|
||||||
mWifiIconId,
|
mWifiIconId,
|
||||||
mWifiActivityIconId,
|
mWifiActivityIconId,
|
||||||
mContentDescriptionWifi);
|
mContentDescriptionWifi);
|
||||||
cluster.setMobileDataIndicators(
|
|
||||||
mHasMobileDataFeature,
|
|
||||||
mShowPhoneRSSIForData ? mPhoneSignalIconId : mDataSignalIconId,
|
|
||||||
mMobileActivityIconId,
|
|
||||||
mDataTypeIconId,
|
|
||||||
mContentDescriptionPhoneSignal,
|
|
||||||
mContentDescriptionDataType);
|
|
||||||
|
|
||||||
|
if (mIsWimaxEnabled && mWimaxConnected) {
|
||||||
|
// wimax is special
|
||||||
|
cluster.setMobileDataIndicators(
|
||||||
|
true,
|
||||||
|
mWimaxIconId,
|
||||||
|
mMobileActivityIconId,
|
||||||
|
mDataTypeIconId,
|
||||||
|
mContentDescriptionWimax,
|
||||||
|
mContentDescriptionDataType);
|
||||||
|
} else {
|
||||||
|
// normal mobile data
|
||||||
|
cluster.setMobileDataIndicators(
|
||||||
|
mHasMobileDataFeature,
|
||||||
|
mShowPhoneRSSIForData ? mPhoneSignalIconId : mDataSignalIconId,
|
||||||
|
mMobileActivityIconId,
|
||||||
|
mDataTypeIconId,
|
||||||
|
mContentDescriptionPhoneSignal,
|
||||||
|
mContentDescriptionDataType);
|
||||||
|
}
|
||||||
|
cluster.setIsAirplaneMode(mAirplaneMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStackedMode(boolean stacked) {
|
public void setStackedMode(boolean stacked) {
|
||||||
@ -311,7 +329,7 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
} else if (action.equals(WimaxManagerConstants.NET_4G_STATE_CHANGED_ACTION) ||
|
} else if (action.equals(WimaxManagerConstants.NET_4G_STATE_CHANGED_ACTION) ||
|
||||||
action.equals(WimaxManagerConstants.SIGNAL_LEVEL_CHANGED_ACTION) ||
|
action.equals(WimaxManagerConstants.SIGNAL_LEVEL_CHANGED_ACTION) ||
|
||||||
action.equals(WimaxManagerConstants.WIMAX_NETWORK_STATE_CHANGED_ACTION)) {
|
action.equals(WimaxManagerConstants.WIMAX_NETWORK_STATE_CHANGED_ACTION)) {
|
||||||
updateWimaxState(intent);
|
updateWimaxState(intent);
|
||||||
refreshViews();
|
refreshViews();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -466,91 +484,100 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final void updateDataNetType() {
|
private final void updateDataNetType() {
|
||||||
switch (mDataNetType) {
|
if (mIsWimaxEnabled && mWimaxConnected) {
|
||||||
case TelephonyManager.NETWORK_TYPE_UNKNOWN:
|
// wimax is a special 4g network not handled by telephony
|
||||||
if (!mShowAtLeastThreeGees) {
|
mDataIconList = TelephonyIcons.DATA_4G[mInetCondition];
|
||||||
mDataIconList = TelephonyIcons.DATA_G[mInetCondition];
|
mDataTypeIconId = R.drawable.stat_sys_data_connected_4g;
|
||||||
mDataTypeIconId = 0;
|
mContentDescriptionDataType = mContext.getString(
|
||||||
mContentDescriptionDataType = mContext.getString(
|
R.string.accessibility_data_connection_4g);
|
||||||
R.string.accessibility_data_connection_gprs);
|
} else {
|
||||||
break;
|
switch (mDataNetType) {
|
||||||
} else {
|
case TelephonyManager.NETWORK_TYPE_UNKNOWN:
|
||||||
// fall through
|
if (!mShowAtLeastThreeGees) {
|
||||||
}
|
mDataIconList = TelephonyIcons.DATA_G[mInetCondition];
|
||||||
case TelephonyManager.NETWORK_TYPE_EDGE:
|
mDataTypeIconId = 0;
|
||||||
if (!mShowAtLeastThreeGees) {
|
mContentDescriptionDataType = mContext.getString(
|
||||||
mDataIconList = TelephonyIcons.DATA_E[mInetCondition];
|
R.string.accessibility_data_connection_gprs);
|
||||||
mDataTypeIconId = R.drawable.stat_sys_data_connected_e;
|
break;
|
||||||
mContentDescriptionDataType = mContext.getString(
|
} else {
|
||||||
R.string.accessibility_data_connection_edge);
|
// fall through
|
||||||
break;
|
}
|
||||||
} else {
|
case TelephonyManager.NETWORK_TYPE_EDGE:
|
||||||
// fall through
|
if (!mShowAtLeastThreeGees) {
|
||||||
}
|
mDataIconList = TelephonyIcons.DATA_E[mInetCondition];
|
||||||
case TelephonyManager.NETWORK_TYPE_UMTS:
|
mDataTypeIconId = R.drawable.stat_sys_data_connected_e;
|
||||||
mDataIconList = TelephonyIcons.DATA_3G[mInetCondition];
|
mContentDescriptionDataType = mContext.getString(
|
||||||
mDataTypeIconId = R.drawable.stat_sys_data_connected_3g;
|
R.string.accessibility_data_connection_edge);
|
||||||
mContentDescriptionDataType = mContext.getString(
|
break;
|
||||||
R.string.accessibility_data_connection_3g);
|
} else {
|
||||||
break;
|
// fall through
|
||||||
case TelephonyManager.NETWORK_TYPE_HSDPA:
|
}
|
||||||
case TelephonyManager.NETWORK_TYPE_HSUPA:
|
case TelephonyManager.NETWORK_TYPE_UMTS:
|
||||||
case TelephonyManager.NETWORK_TYPE_HSPA:
|
|
||||||
case TelephonyManager.NETWORK_TYPE_HSPAP:
|
|
||||||
if (mHspaDataDistinguishable) {
|
|
||||||
mDataIconList = TelephonyIcons.DATA_H[mInetCondition];
|
|
||||||
mDataTypeIconId = R.drawable.stat_sys_data_connected_h;
|
|
||||||
mContentDescriptionDataType = mContext.getString(
|
|
||||||
R.string.accessibility_data_connection_3_5g);
|
|
||||||
} else {
|
|
||||||
mDataIconList = TelephonyIcons.DATA_3G[mInetCondition];
|
mDataIconList = TelephonyIcons.DATA_3G[mInetCondition];
|
||||||
mDataTypeIconId = R.drawable.stat_sys_data_connected_3g;
|
mDataTypeIconId = R.drawable.stat_sys_data_connected_3g;
|
||||||
mContentDescriptionDataType = mContext.getString(
|
mContentDescriptionDataType = mContext.getString(
|
||||||
R.string.accessibility_data_connection_3g);
|
R.string.accessibility_data_connection_3g);
|
||||||
}
|
break;
|
||||||
break;
|
case TelephonyManager.NETWORK_TYPE_HSDPA:
|
||||||
case TelephonyManager.NETWORK_TYPE_CDMA:
|
case TelephonyManager.NETWORK_TYPE_HSUPA:
|
||||||
// display 1xRTT for IS95A/B
|
case TelephonyManager.NETWORK_TYPE_HSPA:
|
||||||
mDataIconList = TelephonyIcons.DATA_1X[mInetCondition];
|
case TelephonyManager.NETWORK_TYPE_HSPAP:
|
||||||
mDataTypeIconId = R.drawable.stat_sys_data_connected_1x;
|
if (mHspaDataDistinguishable) {
|
||||||
mContentDescriptionDataType = mContext.getString(
|
mDataIconList = TelephonyIcons.DATA_H[mInetCondition];
|
||||||
R.string.accessibility_data_connection_cdma);
|
mDataTypeIconId = R.drawable.stat_sys_data_connected_h;
|
||||||
break;
|
mContentDescriptionDataType = mContext.getString(
|
||||||
case TelephonyManager.NETWORK_TYPE_1xRTT:
|
R.string.accessibility_data_connection_3_5g);
|
||||||
mDataIconList = TelephonyIcons.DATA_1X[mInetCondition];
|
} else {
|
||||||
mDataTypeIconId = R.drawable.stat_sys_data_connected_1x;
|
mDataIconList = TelephonyIcons.DATA_3G[mInetCondition];
|
||||||
mContentDescriptionDataType = mContext.getString(
|
mDataTypeIconId = R.drawable.stat_sys_data_connected_3g;
|
||||||
R.string.accessibility_data_connection_cdma);
|
mContentDescriptionDataType = mContext.getString(
|
||||||
break;
|
R.string.accessibility_data_connection_3g);
|
||||||
case TelephonyManager.NETWORK_TYPE_EVDO_0: //fall through
|
}
|
||||||
case TelephonyManager.NETWORK_TYPE_EVDO_A:
|
break;
|
||||||
case TelephonyManager.NETWORK_TYPE_EVDO_B:
|
case TelephonyManager.NETWORK_TYPE_CDMA:
|
||||||
case TelephonyManager.NETWORK_TYPE_EHRPD:
|
// display 1xRTT for IS95A/B
|
||||||
mDataIconList = TelephonyIcons.DATA_3G[mInetCondition];
|
mDataIconList = TelephonyIcons.DATA_1X[mInetCondition];
|
||||||
mDataTypeIconId = R.drawable.stat_sys_data_connected_3g;
|
mDataTypeIconId = R.drawable.stat_sys_data_connected_1x;
|
||||||
mContentDescriptionDataType = mContext.getString(
|
|
||||||
R.string.accessibility_data_connection_3g);
|
|
||||||
break;
|
|
||||||
case TelephonyManager.NETWORK_TYPE_LTE:
|
|
||||||
mDataIconList = TelephonyIcons.DATA_4G[mInetCondition];
|
|
||||||
mDataTypeIconId = R.drawable.stat_sys_data_connected_4g;
|
|
||||||
mContentDescriptionDataType = mContext.getString(
|
|
||||||
R.string.accessibility_data_connection_4g);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (!mShowAtLeastThreeGees) {
|
|
||||||
mDataIconList = TelephonyIcons.DATA_G[mInetCondition];
|
|
||||||
mDataTypeIconId = R.drawable.stat_sys_data_connected_g;
|
|
||||||
mContentDescriptionDataType = mContext.getString(
|
mContentDescriptionDataType = mContext.getString(
|
||||||
R.string.accessibility_data_connection_gprs);
|
R.string.accessibility_data_connection_cdma);
|
||||||
} else {
|
break;
|
||||||
|
case TelephonyManager.NETWORK_TYPE_1xRTT:
|
||||||
|
mDataIconList = TelephonyIcons.DATA_1X[mInetCondition];
|
||||||
|
mDataTypeIconId = R.drawable.stat_sys_data_connected_1x;
|
||||||
|
mContentDescriptionDataType = mContext.getString(
|
||||||
|
R.string.accessibility_data_connection_cdma);
|
||||||
|
break;
|
||||||
|
case TelephonyManager.NETWORK_TYPE_EVDO_0: //fall through
|
||||||
|
case TelephonyManager.NETWORK_TYPE_EVDO_A:
|
||||||
|
case TelephonyManager.NETWORK_TYPE_EVDO_B:
|
||||||
|
case TelephonyManager.NETWORK_TYPE_EHRPD:
|
||||||
mDataIconList = TelephonyIcons.DATA_3G[mInetCondition];
|
mDataIconList = TelephonyIcons.DATA_3G[mInetCondition];
|
||||||
mDataTypeIconId = R.drawable.stat_sys_data_connected_3g;
|
mDataTypeIconId = R.drawable.stat_sys_data_connected_3g;
|
||||||
mContentDescriptionDataType = mContext.getString(
|
mContentDescriptionDataType = mContext.getString(
|
||||||
R.string.accessibility_data_connection_3g);
|
R.string.accessibility_data_connection_3g);
|
||||||
}
|
break;
|
||||||
break;
|
case TelephonyManager.NETWORK_TYPE_LTE:
|
||||||
|
mDataIconList = TelephonyIcons.DATA_4G[mInetCondition];
|
||||||
|
mDataTypeIconId = R.drawable.stat_sys_data_connected_4g;
|
||||||
|
mContentDescriptionDataType = mContext.getString(
|
||||||
|
R.string.accessibility_data_connection_4g);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (!mShowAtLeastThreeGees) {
|
||||||
|
mDataIconList = TelephonyIcons.DATA_G[mInetCondition];
|
||||||
|
mDataTypeIconId = R.drawable.stat_sys_data_connected_g;
|
||||||
|
mContentDescriptionDataType = mContext.getString(
|
||||||
|
R.string.accessibility_data_connection_gprs);
|
||||||
|
} else {
|
||||||
|
mDataIconList = TelephonyIcons.DATA_3G[mInetCondition];
|
||||||
|
mDataTypeIconId = R.drawable.stat_sys_data_connected_3g;
|
||||||
|
mContentDescriptionDataType = mContext.getString(
|
||||||
|
R.string.accessibility_data_connection_3g);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((isCdma() && isCdmaEri()) || mPhone.isNetworkRoaming()) {
|
if ((isCdma() && isCdmaEri()) || mPhone.isNetworkRoaming()) {
|
||||||
mDataTypeIconId = R.drawable.stat_sys_data_connected_roam;
|
mDataTypeIconId = R.drawable.stat_sys_data_connected_roam;
|
||||||
}
|
}
|
||||||
@ -763,8 +790,7 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ===== Wimax ===================================================================
|
// ===== Wimax ===================================================================
|
||||||
|
|
||||||
private final void updateWimaxState(Intent intent) {
|
private final void updateWimaxState(Intent intent) {
|
||||||
final String action = intent.getAction();
|
final String action = intent.getAction();
|
||||||
boolean wasConnected = mWimaxConnected;
|
boolean wasConnected = mWimaxConnected;
|
||||||
@ -772,42 +798,41 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
int wimaxStatus = intent.getIntExtra(WimaxManagerConstants.EXTRA_4G_STATE,
|
int wimaxStatus = intent.getIntExtra(WimaxManagerConstants.EXTRA_4G_STATE,
|
||||||
WimaxManagerConstants.NET_4G_STATE_UNKNOWN);
|
WimaxManagerConstants.NET_4G_STATE_UNKNOWN);
|
||||||
mIsWimaxEnabled = (wimaxStatus ==
|
mIsWimaxEnabled = (wimaxStatus ==
|
||||||
WimaxManagerConstants.NET_4G_STATE_ENABLED)? true : false;
|
WimaxManagerConstants.NET_4G_STATE_ENABLED);
|
||||||
} else if (action.equals(WimaxManagerConstants.SIGNAL_LEVEL_CHANGED_ACTION)) {
|
} else if (action.equals(WimaxManagerConstants.SIGNAL_LEVEL_CHANGED_ACTION)) {
|
||||||
mWimaxSignal = intent.getIntExtra(WimaxManagerConstants.EXTRA_NEW_SIGNAL_LEVEL, 0);
|
mWimaxSignal = intent.getIntExtra(WimaxManagerConstants.EXTRA_NEW_SIGNAL_LEVEL, 0);
|
||||||
} else if (action.equals(WimaxManagerConstants.WIMAX_NETWORK_STATE_CHANGED_ACTION)) {
|
} else if (action.equals(WimaxManagerConstants.WIMAX_NETWORK_STATE_CHANGED_ACTION)) {
|
||||||
mWimaxState = intent.getIntExtra(WimaxManagerConstants.EXTRA_WIMAX_STATE,
|
mWimaxState = intent.getIntExtra(WimaxManagerConstants.EXTRA_WIMAX_STATE,
|
||||||
WimaxManagerConstants.NET_4G_STATE_UNKNOWN);
|
WimaxManagerConstants.NET_4G_STATE_UNKNOWN);
|
||||||
mWimaxExtraState = intent.getIntExtra(
|
mWimaxExtraState = intent.getIntExtra(
|
||||||
WimaxManagerConstants.EXTRA_WIMAX_STATE_DETAIL,
|
WimaxManagerConstants.EXTRA_WIMAX_STATE_DETAIL,
|
||||||
WimaxManagerConstants.NET_4G_STATE_UNKNOWN);
|
WimaxManagerConstants.NET_4G_STATE_UNKNOWN);
|
||||||
mWimaxConnected = (mWimaxState ==
|
mWimaxConnected = (mWimaxState ==
|
||||||
WimaxManagerConstants.WIMAX_STATE_CONNECTED) ? true : false;
|
WimaxManagerConstants.WIMAX_STATE_CONNECTED);
|
||||||
mWimaxIdle = (mWimaxExtraState == WimaxManagerConstants.WIMAX_IDLE)? true : false;
|
mWimaxIdle = (mWimaxExtraState == WimaxManagerConstants.WIMAX_IDLE);
|
||||||
}
|
}
|
||||||
|
updateDataNetType();
|
||||||
updateWimaxIcons();
|
updateWimaxIcons();
|
||||||
}
|
}
|
||||||
private void updateWimaxIcons() {
|
|
||||||
Slog.d(TAG, "in .... updateWimaxIcons function : "+mIsWimaxEnabled);
|
private void updateWimaxIcons() {
|
||||||
if (mIsWimaxEnabled) {
|
if (mIsWimaxEnabled) {
|
||||||
if (mWimaxConnected) {
|
if (mWimaxConnected) {
|
||||||
Slog.d(TAG, "in .... updateWimaxIcons function WiMAX COnnected");
|
if (mWimaxIdle)
|
||||||
if (mWimaxIdle)
|
mWimaxIconId = WimaxIcons.WIMAX_IDLE;
|
||||||
mWimaxIconId = WimaxIcons.WIMAX_IDLE;
|
else
|
||||||
else
|
mWimaxIconId = WimaxIcons.WIMAX_SIGNAL_STRENGTH[mInetCondition][mWimaxSignal];
|
||||||
mWimaxIconId = WimaxIcons.WIMAX_SIGNAL_STRENGTH[mInetCondition][mWimaxSignal];
|
mContentDescriptionWimax = mContext.getString(
|
||||||
mContentDescriptionWimax = mContext.getString(
|
AccessibilityContentDescriptions.WIMAX_CONNECTION_STRENGTH[mWimaxSignal]);
|
||||||
AccessibilityContentDescriptions.WIMAX_CONNECTION_STRENGTH[mWimaxSignal]);
|
} else {
|
||||||
} else {
|
mWimaxIconId = WimaxIcons.WIMAX_DISCONNECTED;
|
||||||
Slog.d(TAG, "in .... updateWimaxIcons function WiMAX Disconnected");
|
mContentDescriptionWimax = mContext.getString(R.string.accessibility_no_wimax);
|
||||||
mWimaxIconId = WimaxIcons.WIMAX_DISCONNECTED;
|
}
|
||||||
mContentDescriptionWimax = mContext.getString(R.string.accessibility_no_wimax);
|
} else {
|
||||||
}
|
mWimaxIconId = 0;
|
||||||
} else {
|
|
||||||
Slog.d(TAG, "in .... updateWimaxIcons function wimax icon id 0");
|
|
||||||
mWimaxIconId = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ===== Full or limited Internet connectivity ==================================
|
// ===== Full or limited Internet connectivity ==================================
|
||||||
|
|
||||||
private void updateConnectivity(Intent intent) {
|
private void updateConnectivity(Intent intent) {
|
||||||
@ -827,14 +852,14 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
mInetCondition = (connectionStatus > INET_CONDITION_THRESHOLD ? 1 : 0);
|
mInetCondition = (connectionStatus > INET_CONDITION_THRESHOLD ? 1 : 0);
|
||||||
|
|
||||||
if (info != null && info.getType() == ConnectivityManager.TYPE_BLUETOOTH) {
|
if (info != null && info.getType() == ConnectivityManager.TYPE_BLUETOOTH) {
|
||||||
mBluetoothTethered = info.isConnected() ? true: false;
|
mBluetoothTethered = info.isConnected();
|
||||||
} else {
|
} else {
|
||||||
mBluetoothTethered = false;
|
mBluetoothTethered = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We want to update all the icons, all at once, for any condition change
|
// We want to update all the icons, all at once, for any condition change
|
||||||
updateDataNetType();
|
updateDataNetType();
|
||||||
updateWimaxIcons();
|
updateWimaxIcons();
|
||||||
updateDataIcon();
|
updateDataIcon();
|
||||||
updateTelephonySignalStrength();
|
updateTelephonySignalStrength();
|
||||||
updateWifiIcons();
|
updateWifiIcons();
|
||||||
@ -921,7 +946,7 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
|
|
||||||
combinedSignalIconId = mDataSignalIconId;
|
combinedSignalIconId = mDataSignalIconId;
|
||||||
}
|
}
|
||||||
else if (!mDataConnected && !mWifiConnected && !mBluetoothTethered) {
|
else if (!mDataConnected && !mWifiConnected && !mBluetoothTethered && !mWimaxConnected) {
|
||||||
// pretty much totally disconnected
|
// pretty much totally disconnected
|
||||||
|
|
||||||
label = context.getString(R.string.status_bar_settings_signal_meter_disconnected);
|
label = context.getString(R.string.status_bar_settings_signal_meter_disconnected);
|
||||||
@ -961,23 +986,12 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
if (mLastPhoneSignalIconId != mPhoneSignalIconId
|
if (mLastPhoneSignalIconId != mPhoneSignalIconId
|
||||||
|| mLastDataDirectionOverlayIconId != combinedActivityIconId
|
|| mLastDataDirectionOverlayIconId != combinedActivityIconId
|
||||||
|| mLastWifiIconId != mWifiIconId
|
|| mLastWifiIconId != mWifiIconId
|
||||||
|
|| mLastWimaxIconId != mWimaxIconId
|
||||||
|| mLastDataTypeIconId != mDataTypeIconId)
|
|| mLastDataTypeIconId != mDataTypeIconId)
|
||||||
{
|
{
|
||||||
// NB: the mLast*s will be updated later
|
// NB: the mLast*s will be updated later
|
||||||
for (SignalCluster cluster : mSignalClusters) {
|
for (SignalCluster cluster : mSignalClusters) {
|
||||||
cluster.setWifiIndicators(
|
refreshSignalCluster(cluster);
|
||||||
mWifiConnected, // only show wifi in the cluster if connected
|
|
||||||
mWifiIconId,
|
|
||||||
mWifiActivityIconId,
|
|
||||||
mContentDescriptionWifi);
|
|
||||||
cluster.setMobileDataIndicators(
|
|
||||||
mHasMobileDataFeature,
|
|
||||||
mShowPhoneRSSIForData ? mPhoneSignalIconId : mDataSignalIconId,
|
|
||||||
mMobileActivityIconId,
|
|
||||||
mDataTypeIconId,
|
|
||||||
mContentDescriptionPhoneSignal,
|
|
||||||
mContentDescriptionDataType);
|
|
||||||
cluster.setIsAirplaneMode(mAirplaneMode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1152,11 +1166,22 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
pw.println(mWifiLevel);
|
pw.println(mWifiLevel);
|
||||||
pw.print(" mWifiSsid=");
|
pw.print(" mWifiSsid=");
|
||||||
pw.println(mWifiSsid);
|
pw.println(mWifiSsid);
|
||||||
pw.print(String.format(" mWifiIconId=0x%08x/%s",
|
pw.println(String.format(" mWifiIconId=0x%08x/%s",
|
||||||
mWifiIconId, getResourceName(mWifiIconId)));
|
mWifiIconId, getResourceName(mWifiIconId)));
|
||||||
pw.print(" mWifiActivity=");
|
pw.print(" mWifiActivity=");
|
||||||
pw.println(mWifiActivity);
|
pw.println(mWifiActivity);
|
||||||
|
|
||||||
|
if (mWimaxSupported) {
|
||||||
|
pw.println(" - wimax ------");
|
||||||
|
pw.print(" mIsWimaxEnabled="); pw.println(mIsWimaxEnabled);
|
||||||
|
pw.print(" mWimaxConnected="); pw.println(mWimaxConnected);
|
||||||
|
pw.print(" mWimaxIdle="); pw.println(mWimaxIdle);
|
||||||
|
pw.println(String.format(" mWimaxIconId=0x%08x/%s",
|
||||||
|
mWimaxIconId, getResourceName(mWimaxIconId)));
|
||||||
|
pw.println(String.format(" mWimaxSignal=%d", mWimaxSignal));
|
||||||
|
pw.println(String.format(" mWimaxState=%d", mWimaxState));
|
||||||
|
pw.println(String.format(" mWimaxExtraState=%d", mWimaxExtraState));
|
||||||
|
}
|
||||||
|
|
||||||
pw.println(" - Bluetooth ----");
|
pw.println(" - Bluetooth ----");
|
||||||
pw.print(" mBtReverseTethered=");
|
pw.print(" mBtReverseTethered=");
|
||||||
@ -1190,7 +1215,7 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
pw.print(" mLastDataTypeIconId=0x");
|
pw.print(" mLastDataTypeIconId=0x");
|
||||||
pw.print(Integer.toHexString(mLastDataTypeIconId));
|
pw.print(Integer.toHexString(mLastDataTypeIconId));
|
||||||
pw.print("/");
|
pw.print("/");
|
||||||
pw.println(getResourceName(mLastCombinedSignalIconId));
|
pw.println(getResourceName(mLastDataTypeIconId));
|
||||||
pw.print(" mLastLabel=");
|
pw.print(" mLastLabel=");
|
||||||
pw.print(mLastLabel);
|
pw.print(mLastLabel);
|
||||||
pw.println("");
|
pw.println("");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2008 The Android Open Source Project
|
* Copyright (C) 2011 The Android Open Source Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -16,22 +16,13 @@
|
|||||||
|
|
||||||
package com.android.systemui.statusbar.policy;
|
package com.android.systemui.statusbar.policy;
|
||||||
|
|
||||||
|
import com.android.systemui.statusbar.policy.TelephonyIcons;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
|
|
||||||
class WimaxIcons {
|
class WimaxIcons {
|
||||||
static final int[][] WIMAX_SIGNAL_STRENGTH = {
|
static final int[][] WIMAX_SIGNAL_STRENGTH = TelephonyIcons.DATA_SIGNAL_STRENGTH;
|
||||||
{ R.drawable.stat_sys_data_wimax_signal_0,
|
|
||||||
R.drawable.stat_sys_data_wimax_signal_1,
|
|
||||||
R.drawable.stat_sys_data_wimax_signal_2,
|
|
||||||
R.drawable.stat_sys_data_wimax_signal_3 },
|
|
||||||
{ R.drawable.stat_sys_data_wimax_signal_0_fully,
|
|
||||||
R.drawable.stat_sys_data_wimax_signal_1_fully,
|
|
||||||
R.drawable.stat_sys_data_wimax_signal_2_fully,
|
|
||||||
R.drawable.stat_sys_data_wimax_signal_3_fully }
|
|
||||||
};
|
|
||||||
|
|
||||||
static final int WIMAX_DISCONNECTED =
|
static final int WIMAX_DISCONNECTED = WIMAX_SIGNAL_STRENGTH[0][0];
|
||||||
R.drawable.stat_sys_data_wimax_signal_disconnected;
|
|
||||||
static final int WIMAX_IDLE = R.drawable.stat_sys_data_wimax_signal_idle;
|
static final int WIMAX_IDLE = WIMAX_DISCONNECTED; // XXX: unclear if we need a different icon
|
||||||
static final int WIFI_LEVEL_COUNT = WIMAX_SIGNAL_STRENGTH[0].length;
|
|
||||||
}
|
}
|
||||||
|
@ -514,7 +514,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
mCurrentLinkProperties[netType] = null;
|
mCurrentLinkProperties[netType] = null;
|
||||||
if (mNetConfigs[netType].isDefault()) mNetTrackers[netType].reconnect();
|
if (mNetTrackers[netType] != null && mNetConfigs[netType].isDefault()) {
|
||||||
|
mNetTrackers[netType].reconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE);
|
IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE);
|
||||||
|
@ -806,9 +806,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
|||||||
final NetworkStats networkDevSnapshot;
|
final NetworkStats networkDevSnapshot;
|
||||||
try {
|
try {
|
||||||
// collect any tethering stats
|
// collect any tethering stats
|
||||||
final String[] tetheredIfacePairs = mConnManager.getTetheredIfacePairs();
|
final NetworkStats tetherSnapshot = getNetworkStatsTethering();
|
||||||
final NetworkStats tetherSnapshot = mNetworkManager.getNetworkStatsTethering(
|
|
||||||
tetheredIfacePairs);
|
|
||||||
|
|
||||||
// record uid stats, folding in tethering stats
|
// record uid stats, folding in tethering stats
|
||||||
uidSnapshot = mNetworkManager.getNetworkStatsUidDetail(UID_ALL);
|
uidSnapshot = mNetworkManager.getNetworkStatsUidDetail(UID_ALL);
|
||||||
@ -1505,7 +1503,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
|||||||
NetworkStats before, NetworkStats current, boolean collectStale, String type) {
|
NetworkStats before, NetworkStats current, boolean collectStale, String type) {
|
||||||
if (before != null) {
|
if (before != null) {
|
||||||
try {
|
try {
|
||||||
return current.subtract(before);
|
return current.subtract(before, false);
|
||||||
} catch (NonMonotonicException e) {
|
} catch (NonMonotonicException e) {
|
||||||
Log.w(TAG, "found non-monotonic values; saving to dropbox");
|
Log.w(TAG, "found non-monotonic values; saving to dropbox");
|
||||||
|
|
||||||
@ -1517,8 +1515,13 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
|||||||
builder.append("right=").append(e.right).append('\n');
|
builder.append("right=").append(e.right).append('\n');
|
||||||
mDropBox.addText(TAG_NETSTATS_ERROR, builder.toString());
|
mDropBox.addText(TAG_NETSTATS_ERROR, builder.toString());
|
||||||
|
|
||||||
// return empty delta to avoid recording broken stats
|
try {
|
||||||
return new NetworkStats(0L, 10);
|
// return clamped delta to help recover
|
||||||
|
return current.subtract(before, true);
|
||||||
|
} catch (NonMonotonicException e1) {
|
||||||
|
Log.wtf(TAG, "found non-monotonic values; returning empty delta", e1);
|
||||||
|
return new NetworkStats(0L, 10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (collectStale) {
|
} else if (collectStale) {
|
||||||
// caller is okay collecting stale stats for first call.
|
// caller is okay collecting stale stats for first call.
|
||||||
@ -1530,6 +1533,20 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return snapshot of current tethering statistics. Will return empty
|
||||||
|
* {@link NetworkStats} if any problems are encountered.
|
||||||
|
*/
|
||||||
|
private NetworkStats getNetworkStatsTethering() throws RemoteException {
|
||||||
|
try {
|
||||||
|
final String[] tetheredIfacePairs = mConnManager.getTetheredIfacePairs();
|
||||||
|
return mNetworkManager.getNetworkStatsTethering(tetheredIfacePairs);
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
Log.wtf(TAG, "problem reading network stats", e);
|
||||||
|
return new NetworkStats(0L, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static NetworkStats computeNetworkXtSnapshotFromUid(NetworkStats uidSnapshot) {
|
private static NetworkStats computeNetworkXtSnapshotFromUid(NetworkStats uidSnapshot) {
|
||||||
return uidSnapshot.groupedByIface();
|
return uidSnapshot.groupedByIface();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user