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 <core/SkBitmap.h>
|
||||
#include <core/SkStream.h>
|
||||
#include <images/SkImageDecoder.h>
|
||||
|
||||
#include <GLES/gl.h>
|
||||
@ -150,9 +151,15 @@ status_t BootAnimation::initTexture(void* buffer, size_t len)
|
||||
//StopWatch watch("blah");
|
||||
|
||||
SkBitmap bitmap;
|
||||
SkImageDecoder::DecodeMemory(buffer, len,
|
||||
&bitmap, SkBitmap::kRGB_565_Config,
|
||||
SkImageDecoder::kDecodePixels_Mode);
|
||||
SkMemoryStream stream(buffer, len);
|
||||
SkImageDecoder* codec = SkImageDecoder::Factory(&stream);
|
||||
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
|
||||
// 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,
|
||||
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
|
||||
final Animator anim = baseAnimator.clone();
|
||||
|
||||
|
@ -212,7 +212,11 @@ public class WallpaperManager {
|
||||
*/
|
||||
mHandler.sendEmptyMessage(MSG_CLEAR_WALLPAPER);
|
||||
}
|
||||
|
||||
|
||||
public Handler getHandler() {
|
||||
return mHandler;
|
||||
}
|
||||
|
||||
public Bitmap peekWallpaperBitmap(Context context, boolean returnDefault) {
|
||||
synchronized (this) {
|
||||
if (mWallpaper != null) {
|
||||
@ -604,7 +608,7 @@ public class WallpaperManager {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
@ -619,16 +623,23 @@ public class WallpaperManager {
|
||||
* @param yOffset The offset along the Y dimension, from 0 to 1.
|
||||
*/
|
||||
public void setWallpaperOffsets(IBinder windowToken, float xOffset, float yOffset) {
|
||||
try {
|
||||
//Log.v(TAG, "Sending new wallpaper offsets from app...");
|
||||
ViewRootImpl.getWindowSession(mContext.getMainLooper()).setWallpaperPosition(
|
||||
windowToken, xOffset, yOffset, mWallpaperXStep, mWallpaperYStep);
|
||||
//Log.v(TAG, "...app returning after sending offsets!");
|
||||
} catch (RemoteException e) {
|
||||
// Ignore.
|
||||
}
|
||||
final IBinder fWindowToken = windowToken;
|
||||
final float fXOffset = xOffset;
|
||||
final float fYOffset = yOffset;
|
||||
sGlobals.getHandler().post(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
//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,
|
||||
* 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.
|
||||
*/
|
||||
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;
|
||||
if (deltaRealtime < 0) {
|
||||
throw new NonMonotonicException(this, value);
|
||||
@ -497,7 +510,15 @@ public class NetworkStats implements Parcelable {
|
||||
|
||||
if (entry.rxBytes < 0 || entry.rxPackets < 0 || entry.txBytes < 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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@ -25,6 +25,7 @@ import android.opengl.GLUtils;
|
||||
import android.os.SystemClock;
|
||||
import android.os.SystemProperties;
|
||||
import android.util.Log;
|
||||
import com.google.android.gles_jni.EGLImpl;
|
||||
|
||||
import javax.microedition.khronos.egl.EGL10;
|
||||
import javax.microedition.khronos.egl.EGL11;
|
||||
@ -343,6 +344,15 @@ public abstract class HardwareRenderer {
|
||||
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.
|
||||
*
|
||||
@ -651,6 +661,8 @@ public abstract class HardwareRenderer {
|
||||
throw new Surface.OutOfResourcesException("eglMakeCurrent failed "
|
||||
+ GLUtils.getEGLErrorString(sEgl.eglGetError()));
|
||||
}
|
||||
|
||||
initCaches();
|
||||
|
||||
// If mDirtyRegions is set, this means we have an EGL configuration
|
||||
// with EGL_SWAP_BEHAVIOR_PRESERVED_BIT set
|
||||
@ -671,6 +683,8 @@ public abstract class HardwareRenderer {
|
||||
return mEglContext.getGL();
|
||||
}
|
||||
|
||||
abstract void initCaches();
|
||||
|
||||
EGLContext createContext(EGL10 egl, EGLDisplay eglDisplay, EGLConfig eglConfig) {
|
||||
int[] attribs = { EGL_CONTEXT_CLIENT_VERSION, mGlVersion, EGL_NONE };
|
||||
|
||||
@ -914,6 +928,11 @@ public abstract class HardwareRenderer {
|
||||
EGL_NONE
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
void initCaches() {
|
||||
GLES20Canvas.initCaches();
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean canDraw() {
|
||||
@ -1006,16 +1025,7 @@ public abstract class HardwareRenderer {
|
||||
if (eglContext == null) {
|
||||
return;
|
||||
} else {
|
||||
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);
|
||||
usePbufferSurface(eglContext);
|
||||
}
|
||||
|
||||
switch (level) {
|
||||
@ -1029,5 +1039,46 @@ public abstract class HardwareRenderer {
|
||||
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.isEnabled()) {
|
||||
mAttachInfo.mHardwareRenderer.destroyLayers(mView);
|
||||
@ -880,12 +880,10 @@ public final class ViewRootImpl extends Handler implements ViewParent,
|
||||
|| mNewSurfaceNeeded;
|
||||
|
||||
WindowManager.LayoutParams params = null;
|
||||
int windowAttributesChanges = 0;
|
||||
if (mWindowAttributesChanged) {
|
||||
mWindowAttributesChanged = false;
|
||||
surfaceChanged = true;
|
||||
params = lp;
|
||||
windowAttributesChanges = mWindowAttributesChangesFlag;
|
||||
}
|
||||
CompatibilityInfo compatibilityInfo = mCompatibilityInfo.get();
|
||||
if (compatibilityInfo.supportsScreen() == mLastInCompatMode) {
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
package android.view;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.ComponentCallbacks2;
|
||||
import android.content.res.CompatibilityInfo;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.PixelFormat;
|
||||
@ -409,7 +411,30 @@ public class WindowManagerImpl implements WindowManager {
|
||||
*/
|
||||
public void trimMemory(int level) {
|
||||
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.
|
||||
private Rect mLastVisibleRectSent;
|
||||
private Rect mLastGlobalRect;
|
||||
private Rect mLastVisibleRectSent = new Rect();
|
||||
private Rect mLastGlobalRect = new Rect();
|
||||
private Rect mVisibleRect = new Rect();
|
||||
private Rect mGlobalVisibleRect = new Rect();
|
||||
private Point mScrollOffset = new Point();
|
||||
@ -2878,7 +2878,7 @@ public class WebView extends AbsoluteLayout
|
||||
mWebViewCore.sendMessage(EventHub.SET_SCROLL_OFFSET,
|
||||
nativeMoveGeneration(), mSendScrollEvent ? 1 : 0, mScrollOffset);
|
||||
}
|
||||
mLastVisibleRectSent = mVisibleRect;
|
||||
mLastVisibleRectSent.set(mVisibleRect);
|
||||
mPrivateHandler.removeMessages(SWITCH_TO_LONGPRESS);
|
||||
}
|
||||
if (getGlobalVisibleRect(mGlobalVisibleRect)
|
||||
@ -2894,7 +2894,7 @@ public class WebView extends AbsoluteLayout
|
||||
if (!mBlockWebkitViewMessages) {
|
||||
mWebViewCore.sendMessage(EventHub.SET_GLOBAL_BOUNDS, mGlobalVisibleRect);
|
||||
}
|
||||
mLastGlobalRect = mGlobalVisibleRect;
|
||||
mLastGlobalRect.set(mGlobalVisibleRect);
|
||||
}
|
||||
return mVisibleRect;
|
||||
}
|
||||
|
@ -1036,6 +1036,7 @@ public class ImageView extends View {
|
||||
}
|
||||
}
|
||||
|
||||
@RemotableViewMethod
|
||||
@Override
|
||||
public void setVisibility(int visibility) {
|
||||
super.setVisibility(visibility);
|
||||
|
@ -1248,6 +1248,8 @@ public class PopupWindow {
|
||||
*/
|
||||
public void dismiss() {
|
||||
if (isShowing() && mPopupView != null) {
|
||||
mIsShowing = false;
|
||||
|
||||
unregisterForScrollChanged();
|
||||
|
||||
try {
|
||||
@ -1257,7 +1259,6 @@ public class PopupWindow {
|
||||
((ViewGroup) mPopupView).removeView(mContentView);
|
||||
}
|
||||
mPopupView = null;
|
||||
mIsShowing = false;
|
||||
|
||||
if (mOnDismissListener != null) {
|
||||
mOnDismissListener.onDismiss();
|
||||
|
@ -149,7 +149,7 @@ static jint android_nfc_NdefRecord_parseNdefRecord(JNIEnv *e, jobject o,
|
||||
|
||||
/* Set flags field */
|
||||
mFlags = e->GetFieldID(record_cls, "mFlags", "B");
|
||||
e->SetIntField(o, mFlags, record.Flags);
|
||||
e->SetByteField(o, mFlags, record.Flags);
|
||||
|
||||
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
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -756,6 +768,8 @@ static JNINativeMethod gMethods[] = {
|
||||
{ "nPreserveBackBuffer", "()Z", (void*) android_view_GLES20Canvas_preserveBackBuffer },
|
||||
{ "nDisableVsync", "()V", (void*) android_view_GLES20Canvas_disableVsync },
|
||||
{ "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 },
|
||||
{ "nDestroyRenderer", "(I)V", (void*) android_view_GLES20Canvas_destroyRenderer },
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include <EGL/egl.h>
|
||||
#include <GLES/gl.h>
|
||||
|
||||
#include <EGL/egl_display.h>
|
||||
|
||||
#include <surfaceflinger/Surface.h>
|
||||
#include <SkBitmap.h>
|
||||
#include <SkPixelRef.h>
|
||||
@ -173,6 +175,16 @@ static jboolean jni_eglQuerySurface(JNIEnv *_env, jobject _this, jobject display
|
||||
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,
|
||||
jintArray attrib_list, jobjectArray configs, jint config_size, jintArray num_config) {
|
||||
if (display == NULL
|
||||
@ -526,6 +538,8 @@ static JNINativeMethod methods[] = {
|
||||
{"eglInitialize", "(" DISPLAY "[I)Z", (void*)jni_eglInitialize },
|
||||
{"eglQueryContext", "(" DISPLAY CONTEXT "I[I)Z", (void*)jni_eglQueryContext },
|
||||
{"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 },
|
||||
{"_eglCreateContext","(" DISPLAY CONFIG CONTEXT "[I)I", (void*)jni_eglCreateContext },
|
||||
{"eglGetConfigs", "(" DISPLAY "[" CONFIG "I[I)Z", (void*)jni_eglGetConfigs },
|
||||
|
@ -46,22 +46,16 @@ namespace uirenderer {
|
||||
// Constructors/destructor
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Caches::Caches(): Singleton<Caches>(), blend(false), lastSrcMode(GL_ZERO),
|
||||
lastDstMode(GL_ZERO), currentProgram(NULL) {
|
||||
Caches::Caches(): Singleton<Caches>(), mInitialized(false) {
|
||||
GLint maxTextureUnits;
|
||||
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxTextureUnits);
|
||||
if (maxTextureUnits < 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);
|
||||
|
||||
mCurrentBuffer = meshBuffer;
|
||||
mRegionMesh = NULL;
|
||||
init();
|
||||
|
||||
mDebugLevel = readDebugLevel();
|
||||
LOGD("Enabling debug mode %d", mDebugLevel);
|
||||
@ -71,8 +65,40 @@ Caches::Caches(): Singleton<Caches>(), blend(false), lastSrcMode(GL_ZERO),
|
||||
#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;
|
||||
mRegionMesh = NULL;
|
||||
|
||||
fboCache.clear();
|
||||
|
||||
programCache.clear();
|
||||
currentProgram = NULL;
|
||||
|
||||
mInitialized = false;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -86,7 +86,6 @@ struct CacheLogger {
|
||||
|
||||
class ANDROID_API Caches: public Singleton<Caches> {
|
||||
Caches();
|
||||
~Caches();
|
||||
|
||||
friend class Singleton<Caches>;
|
||||
|
||||
@ -108,6 +107,11 @@ public:
|
||||
kFlushMode_Full
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes the cache.
|
||||
*/
|
||||
void init();
|
||||
|
||||
/**
|
||||
* Flush the cache.
|
||||
*
|
||||
@ -115,6 +119,12 @@ public:
|
||||
*/
|
||||
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.
|
||||
* This debug mode provides limited information to app developers.
|
||||
@ -194,6 +204,7 @@ public:
|
||||
|
||||
private:
|
||||
DebugLevel mDebugLevel;
|
||||
bool mInitialized;
|
||||
}; // class Caches
|
||||
|
||||
}; // namespace uirenderer
|
||||
|
@ -314,6 +314,16 @@ class EGLLogWrapper implements EGL11 {
|
||||
checkError();
|
||||
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) {
|
||||
begin("eglInitialize");
|
||||
|
@ -31,6 +31,8 @@ public class EGLImpl implements EGL10 {
|
||||
public native boolean eglInitialize(EGLDisplay display, int[] major_minor);
|
||||
public native boolean eglQueryContext(EGLDisplay display, EGLContext context, 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 eglGetConfigAttrib(EGLDisplay display, EGLConfig config, int attribute, int[] value);
|
||||
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 eglWaitGL();
|
||||
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) {
|
||||
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);
|
||||
} else if (native_window instanceof SurfaceTexture) {
|
||||
eglSurfaceId = _eglCreateWindowSurfaceTexture(display, config,
|
||||
(SurfaceTexture) native_window, attrib_list);
|
||||
native_window, attrib_list);
|
||||
} else {
|
||||
throw new java.lang.UnsupportedOperationException(
|
||||
"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);
|
||||
String eglQueryString(EGLDisplay display, int name);
|
||||
boolean eglQuerySurface(EGLDisplay display, EGLSurface surface, int attribute, int[] value);
|
||||
/** @hide **/
|
||||
boolean eglReleaseThread();
|
||||
boolean eglSwapBuffers(EGLDisplay display, EGLSurface surface);
|
||||
boolean eglTerminate(EGLDisplay display);
|
||||
boolean eglWaitGL();
|
||||
|
@ -91,6 +91,8 @@ public:
|
||||
inline bool isValid() const { return magic == '_dpy'; }
|
||||
inline bool isAlive() const { return isValid(); }
|
||||
|
||||
inline uint32_t getRefsCount() const { return refs; }
|
||||
|
||||
struct strings_t {
|
||||
char const * vendor;
|
||||
char const * version;
|
||||
|
@ -51,7 +51,7 @@
|
||||
android:visibility="gone"
|
||||
android:id="@+id/spacer"
|
||||
/>
|
||||
<FrameLayout
|
||||
<!--<FrameLayout
|
||||
android:id="@+id/wimax_combo"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
@ -72,6 +72,7 @@
|
||||
android:layout_gravity="center|bottom"
|
||||
/>
|
||||
</FrameLayout>
|
||||
-->
|
||||
<FrameLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -257,10 +257,16 @@
|
||||
<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] -->
|
||||
<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>
|
||||
<!-- 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>
|
||||
<!-- 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>
|
||||
<!-- 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>
|
||||
<!-- 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>
|
||||
|
||||
<!-- 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);
|
||||
mNetworkController.addSignalCluster(signalCluster);
|
||||
signalCluster.setNetworkController(mNetworkController);
|
||||
final ImageView wimaxRSSI =
|
||||
(ImageView)sb.findViewById(R.id.wimax_signal);
|
||||
if (wimaxRSSI != null) {
|
||||
mNetworkController.addWimaxIconView(wimaxRSSI);
|
||||
}
|
||||
// final ImageView wimaxRSSI =
|
||||
// (ImageView)sb.findViewById(R.id.wimax_signal);
|
||||
// if (wimaxRSSI != null) {
|
||||
// mNetworkController.addWimaxIconView(wimaxRSSI);
|
||||
// }
|
||||
// Recents Panel
|
||||
mRecentTasksLoader = new RecentTasksLoader(context);
|
||||
updateRecentsPanel();
|
||||
|
@ -111,6 +111,7 @@ public class NetworkController extends BroadcastReceiver {
|
||||
com.android.internal.R.drawable.stat_sys_tether_bluetooth;
|
||||
|
||||
//wimax
|
||||
private boolean mWimaxSupported = false;
|
||||
private boolean mIsWimaxEnabled = false;
|
||||
private boolean mWimaxConnected = false;
|
||||
private boolean mWimaxIdle = false;
|
||||
@ -213,9 +214,9 @@ public class NetworkController extends BroadcastReceiver {
|
||||
filter.addAction(ConnectivityManager.INET_CONDITION_ACTION);
|
||||
filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
|
||||
filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
|
||||
boolean isWimaxConfigEnabled = mContext.getResources().getBoolean(
|
||||
mWimaxSupported = mContext.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_wimaxEnabled);
|
||||
if(isWimaxConfigEnabled) {
|
||||
if(mWimaxSupported) {
|
||||
filter.addAction(WimaxManagerConstants.WIMAX_NETWORK_STATE_CHANGED_ACTION);
|
||||
filter.addAction(WimaxManagerConstants.SIGNAL_LEVEL_CHANGED_ACTION);
|
||||
filter.addAction(WimaxManagerConstants.NET_4G_STATE_CHANGED_ACTION);
|
||||
@ -262,19 +263,36 @@ public class NetworkController extends BroadcastReceiver {
|
||||
|
||||
public void addSignalCluster(SignalCluster cluster) {
|
||||
mSignalClusters.add(cluster);
|
||||
refreshSignalCluster(cluster);
|
||||
}
|
||||
|
||||
public void refreshSignalCluster(SignalCluster cluster) {
|
||||
cluster.setWifiIndicators(
|
||||
mWifiConnected, // only show wifi in the cluster if connected
|
||||
mWifiIconId,
|
||||
mWifiActivityIconId,
|
||||
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) {
|
||||
@ -311,7 +329,7 @@ public class NetworkController extends BroadcastReceiver {
|
||||
} else if (action.equals(WimaxManagerConstants.NET_4G_STATE_CHANGED_ACTION) ||
|
||||
action.equals(WimaxManagerConstants.SIGNAL_LEVEL_CHANGED_ACTION) ||
|
||||
action.equals(WimaxManagerConstants.WIMAX_NETWORK_STATE_CHANGED_ACTION)) {
|
||||
updateWimaxState(intent);
|
||||
updateWimaxState(intent);
|
||||
refreshViews();
|
||||
}
|
||||
}
|
||||
@ -466,91 +484,100 @@ public class NetworkController extends BroadcastReceiver {
|
||||
}
|
||||
|
||||
private final void updateDataNetType() {
|
||||
switch (mDataNetType) {
|
||||
case TelephonyManager.NETWORK_TYPE_UNKNOWN:
|
||||
if (!mShowAtLeastThreeGees) {
|
||||
mDataIconList = TelephonyIcons.DATA_G[mInetCondition];
|
||||
mDataTypeIconId = 0;
|
||||
mContentDescriptionDataType = mContext.getString(
|
||||
R.string.accessibility_data_connection_gprs);
|
||||
break;
|
||||
} else {
|
||||
// fall through
|
||||
}
|
||||
case TelephonyManager.NETWORK_TYPE_EDGE:
|
||||
if (!mShowAtLeastThreeGees) {
|
||||
mDataIconList = TelephonyIcons.DATA_E[mInetCondition];
|
||||
mDataTypeIconId = R.drawable.stat_sys_data_connected_e;
|
||||
mContentDescriptionDataType = mContext.getString(
|
||||
R.string.accessibility_data_connection_edge);
|
||||
break;
|
||||
} else {
|
||||
// fall through
|
||||
}
|
||||
case TelephonyManager.NETWORK_TYPE_UMTS:
|
||||
mDataIconList = TelephonyIcons.DATA_3G[mInetCondition];
|
||||
mDataTypeIconId = R.drawable.stat_sys_data_connected_3g;
|
||||
mContentDescriptionDataType = mContext.getString(
|
||||
R.string.accessibility_data_connection_3g);
|
||||
break;
|
||||
case TelephonyManager.NETWORK_TYPE_HSDPA:
|
||||
case TelephonyManager.NETWORK_TYPE_HSUPA:
|
||||
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 {
|
||||
if (mIsWimaxEnabled && mWimaxConnected) {
|
||||
// wimax is a special 4g network not handled by telephony
|
||||
mDataIconList = TelephonyIcons.DATA_4G[mInetCondition];
|
||||
mDataTypeIconId = R.drawable.stat_sys_data_connected_4g;
|
||||
mContentDescriptionDataType = mContext.getString(
|
||||
R.string.accessibility_data_connection_4g);
|
||||
} else {
|
||||
switch (mDataNetType) {
|
||||
case TelephonyManager.NETWORK_TYPE_UNKNOWN:
|
||||
if (!mShowAtLeastThreeGees) {
|
||||
mDataIconList = TelephonyIcons.DATA_G[mInetCondition];
|
||||
mDataTypeIconId = 0;
|
||||
mContentDescriptionDataType = mContext.getString(
|
||||
R.string.accessibility_data_connection_gprs);
|
||||
break;
|
||||
} else {
|
||||
// fall through
|
||||
}
|
||||
case TelephonyManager.NETWORK_TYPE_EDGE:
|
||||
if (!mShowAtLeastThreeGees) {
|
||||
mDataIconList = TelephonyIcons.DATA_E[mInetCondition];
|
||||
mDataTypeIconId = R.drawable.stat_sys_data_connected_e;
|
||||
mContentDescriptionDataType = mContext.getString(
|
||||
R.string.accessibility_data_connection_edge);
|
||||
break;
|
||||
} else {
|
||||
// fall through
|
||||
}
|
||||
case TelephonyManager.NETWORK_TYPE_UMTS:
|
||||
mDataIconList = TelephonyIcons.DATA_3G[mInetCondition];
|
||||
mDataTypeIconId = R.drawable.stat_sys_data_connected_3g;
|
||||
mContentDescriptionDataType = mContext.getString(
|
||||
R.string.accessibility_data_connection_3g);
|
||||
}
|
||||
break;
|
||||
case TelephonyManager.NETWORK_TYPE_CDMA:
|
||||
// display 1xRTT for IS95A/B
|
||||
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_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];
|
||||
mDataTypeIconId = R.drawable.stat_sys_data_connected_3g;
|
||||
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;
|
||||
break;
|
||||
case TelephonyManager.NETWORK_TYPE_HSDPA:
|
||||
case TelephonyManager.NETWORK_TYPE_HSUPA:
|
||||
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];
|
||||
mDataTypeIconId = R.drawable.stat_sys_data_connected_3g;
|
||||
mContentDescriptionDataType = mContext.getString(
|
||||
R.string.accessibility_data_connection_3g);
|
||||
}
|
||||
break;
|
||||
case TelephonyManager.NETWORK_TYPE_CDMA:
|
||||
// display 1xRTT for IS95A/B
|
||||
mDataIconList = TelephonyIcons.DATA_1X[mInetCondition];
|
||||
mDataTypeIconId = R.drawable.stat_sys_data_connected_1x;
|
||||
mContentDescriptionDataType = mContext.getString(
|
||||
R.string.accessibility_data_connection_gprs);
|
||||
} else {
|
||||
R.string.accessibility_data_connection_cdma);
|
||||
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];
|
||||
mDataTypeIconId = R.drawable.stat_sys_data_connected_3g;
|
||||
mContentDescriptionDataType = mContext.getString(
|
||||
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()) {
|
||||
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) {
|
||||
final String action = intent.getAction();
|
||||
boolean wasConnected = mWimaxConnected;
|
||||
@ -772,42 +798,41 @@ public class NetworkController extends BroadcastReceiver {
|
||||
int wimaxStatus = intent.getIntExtra(WimaxManagerConstants.EXTRA_4G_STATE,
|
||||
WimaxManagerConstants.NET_4G_STATE_UNKNOWN);
|
||||
mIsWimaxEnabled = (wimaxStatus ==
|
||||
WimaxManagerConstants.NET_4G_STATE_ENABLED)? true : false;
|
||||
WimaxManagerConstants.NET_4G_STATE_ENABLED);
|
||||
} else if (action.equals(WimaxManagerConstants.SIGNAL_LEVEL_CHANGED_ACTION)) {
|
||||
mWimaxSignal = intent.getIntExtra(WimaxManagerConstants.EXTRA_NEW_SIGNAL_LEVEL, 0);
|
||||
} 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);
|
||||
mWimaxExtraState = intent.getIntExtra(
|
||||
WimaxManagerConstants.EXTRA_WIMAX_STATE_DETAIL,
|
||||
WimaxManagerConstants.NET_4G_STATE_UNKNOWN);
|
||||
mWimaxConnected = (mWimaxState ==
|
||||
WimaxManagerConstants.WIMAX_STATE_CONNECTED) ? true : false;
|
||||
mWimaxIdle = (mWimaxExtraState == WimaxManagerConstants.WIMAX_IDLE)? true : false;
|
||||
WimaxManagerConstants.WIMAX_STATE_CONNECTED);
|
||||
mWimaxIdle = (mWimaxExtraState == WimaxManagerConstants.WIMAX_IDLE);
|
||||
}
|
||||
updateDataNetType();
|
||||
updateWimaxIcons();
|
||||
}
|
||||
private void updateWimaxIcons() {
|
||||
Slog.d(TAG, "in .... updateWimaxIcons function : "+mIsWimaxEnabled);
|
||||
if (mIsWimaxEnabled) {
|
||||
if (mWimaxConnected) {
|
||||
Slog.d(TAG, "in .... updateWimaxIcons function WiMAX COnnected");
|
||||
if (mWimaxIdle)
|
||||
mWimaxIconId = WimaxIcons.WIMAX_IDLE;
|
||||
else
|
||||
mWimaxIconId = WimaxIcons.WIMAX_SIGNAL_STRENGTH[mInetCondition][mWimaxSignal];
|
||||
mContentDescriptionWimax = mContext.getString(
|
||||
AccessibilityContentDescriptions.WIMAX_CONNECTION_STRENGTH[mWimaxSignal]);
|
||||
} else {
|
||||
Slog.d(TAG, "in .... updateWimaxIcons function WiMAX Disconnected");
|
||||
mWimaxIconId = WimaxIcons.WIMAX_DISCONNECTED;
|
||||
mContentDescriptionWimax = mContext.getString(R.string.accessibility_no_wimax);
|
||||
}
|
||||
} else {
|
||||
Slog.d(TAG, "in .... updateWimaxIcons function wimax icon id 0");
|
||||
mWimaxIconId = 0;
|
||||
}
|
||||
|
||||
private void updateWimaxIcons() {
|
||||
if (mIsWimaxEnabled) {
|
||||
if (mWimaxConnected) {
|
||||
if (mWimaxIdle)
|
||||
mWimaxIconId = WimaxIcons.WIMAX_IDLE;
|
||||
else
|
||||
mWimaxIconId = WimaxIcons.WIMAX_SIGNAL_STRENGTH[mInetCondition][mWimaxSignal];
|
||||
mContentDescriptionWimax = mContext.getString(
|
||||
AccessibilityContentDescriptions.WIMAX_CONNECTION_STRENGTH[mWimaxSignal]);
|
||||
} else {
|
||||
mWimaxIconId = WimaxIcons.WIMAX_DISCONNECTED;
|
||||
mContentDescriptionWimax = mContext.getString(R.string.accessibility_no_wimax);
|
||||
}
|
||||
} else {
|
||||
mWimaxIconId = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// ===== Full or limited Internet connectivity ==================================
|
||||
|
||||
private void updateConnectivity(Intent intent) {
|
||||
@ -827,14 +852,14 @@ public class NetworkController extends BroadcastReceiver {
|
||||
mInetCondition = (connectionStatus > INET_CONDITION_THRESHOLD ? 1 : 0);
|
||||
|
||||
if (info != null && info.getType() == ConnectivityManager.TYPE_BLUETOOTH) {
|
||||
mBluetoothTethered = info.isConnected() ? true: false;
|
||||
mBluetoothTethered = info.isConnected();
|
||||
} else {
|
||||
mBluetoothTethered = false;
|
||||
}
|
||||
|
||||
// We want to update all the icons, all at once, for any condition change
|
||||
updateDataNetType();
|
||||
updateWimaxIcons();
|
||||
updateWimaxIcons();
|
||||
updateDataIcon();
|
||||
updateTelephonySignalStrength();
|
||||
updateWifiIcons();
|
||||
@ -921,7 +946,7 @@ public class NetworkController extends BroadcastReceiver {
|
||||
|
||||
combinedSignalIconId = mDataSignalIconId;
|
||||
}
|
||||
else if (!mDataConnected && !mWifiConnected && !mBluetoothTethered) {
|
||||
else if (!mDataConnected && !mWifiConnected && !mBluetoothTethered && !mWimaxConnected) {
|
||||
// pretty much totally disconnected
|
||||
|
||||
label = context.getString(R.string.status_bar_settings_signal_meter_disconnected);
|
||||
@ -961,23 +986,12 @@ public class NetworkController extends BroadcastReceiver {
|
||||
if (mLastPhoneSignalIconId != mPhoneSignalIconId
|
||||
|| mLastDataDirectionOverlayIconId != combinedActivityIconId
|
||||
|| mLastWifiIconId != mWifiIconId
|
||||
|| mLastWimaxIconId != mWimaxIconId
|
||||
|| mLastDataTypeIconId != mDataTypeIconId)
|
||||
{
|
||||
// NB: the mLast*s will be updated later
|
||||
for (SignalCluster cluster : mSignalClusters) {
|
||||
cluster.setWifiIndicators(
|
||||
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);
|
||||
refreshSignalCluster(cluster);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1152,11 +1166,22 @@ public class NetworkController extends BroadcastReceiver {
|
||||
pw.println(mWifiLevel);
|
||||
pw.print(" mWifiSsid=");
|
||||
pw.println(mWifiSsid);
|
||||
pw.print(String.format(" mWifiIconId=0x%08x/%s",
|
||||
pw.println(String.format(" mWifiIconId=0x%08x/%s",
|
||||
mWifiIconId, getResourceName(mWifiIconId)));
|
||||
pw.print(" 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.print(" mBtReverseTethered=");
|
||||
@ -1190,7 +1215,7 @@ public class NetworkController extends BroadcastReceiver {
|
||||
pw.print(" mLastDataTypeIconId=0x");
|
||||
pw.print(Integer.toHexString(mLastDataTypeIconId));
|
||||
pw.print("/");
|
||||
pw.println(getResourceName(mLastCombinedSignalIconId));
|
||||
pw.println(getResourceName(mLastDataTypeIconId));
|
||||
pw.print(" mLastLabel=");
|
||||
pw.print(mLastLabel);
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -16,22 +16,13 @@
|
||||
|
||||
package com.android.systemui.statusbar.policy;
|
||||
|
||||
import com.android.systemui.statusbar.policy.TelephonyIcons;
|
||||
import com.android.systemui.R;
|
||||
|
||||
class WimaxIcons {
|
||||
static final int[][] WIMAX_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_SIGNAL_STRENGTH = TelephonyIcons.DATA_SIGNAL_STRENGTH;
|
||||
|
||||
static final int WIMAX_DISCONNECTED =
|
||||
R.drawable.stat_sys_data_wimax_signal_disconnected;
|
||||
static final int WIMAX_IDLE = R.drawable.stat_sys_data_wimax_signal_idle;
|
||||
static final int WIFI_LEVEL_COUNT = WIMAX_SIGNAL_STRENGTH[0].length;
|
||||
static final int WIMAX_DISCONNECTED = WIMAX_SIGNAL_STRENGTH[0][0];
|
||||
|
||||
static final int WIMAX_IDLE = WIMAX_DISCONNECTED; // XXX: unclear if we need a different icon
|
||||
}
|
||||
|
@ -514,7 +514,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
continue;
|
||||
}
|
||||
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);
|
||||
|
@ -806,9 +806,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
||||
final NetworkStats networkDevSnapshot;
|
||||
try {
|
||||
// collect any tethering stats
|
||||
final String[] tetheredIfacePairs = mConnManager.getTetheredIfacePairs();
|
||||
final NetworkStats tetherSnapshot = mNetworkManager.getNetworkStatsTethering(
|
||||
tetheredIfacePairs);
|
||||
final NetworkStats tetherSnapshot = getNetworkStatsTethering();
|
||||
|
||||
// record uid stats, folding in tethering stats
|
||||
uidSnapshot = mNetworkManager.getNetworkStatsUidDetail(UID_ALL);
|
||||
@ -1505,7 +1503,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
||||
NetworkStats before, NetworkStats current, boolean collectStale, String type) {
|
||||
if (before != null) {
|
||||
try {
|
||||
return current.subtract(before);
|
||||
return current.subtract(before, false);
|
||||
} catch (NonMonotonicException e) {
|
||||
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');
|
||||
mDropBox.addText(TAG_NETSTATS_ERROR, builder.toString());
|
||||
|
||||
// return empty delta to avoid recording broken stats
|
||||
return new NetworkStats(0L, 10);
|
||||
try {
|
||||
// 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) {
|
||||
// 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) {
|
||||
return uidSnapshot.groupedByIface();
|
||||
}
|
||||
|
Reference in New Issue
Block a user