Thread.setDefaultUncaughtExceptionHandler usage

by Dianne Hackborn » Thu, 21 May 2009 06:02:02 GMT


Sponsored Links
 At a very basic level, if you don't trust the activities you are running in
your process to be stable, then you certainly shouldn't be trusting them
enough to load in your own process in the first place.

On Wed, May 20, 2009 at 3:41 AM, Nik Bhattacharya <





-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. problem animating a view object

Attempting a fairly simple animation of a View.  I'm trying to display
a panel, and then just animate it if the user touches the screen.

Code for my simplified test is below.

The function animateMe() definitely gets called, but nothing happens.

Any help greatly appreciated, thanks.


MAIN FILE:

public class MovePanelsPCT2 extends Activity {
/** Called when the activity is first created. */
@Override
  public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     // setContentView(R.layout.main);
     setContentView(new DrawView(this));
  }
}




DRAW VIEW CLASS:

public class DrawView extends View {
private Panel myPanel;
Point point0 = new Point();

public DrawView(Context context) {
     super(context);
     setFocusable(true); //necessary for getting the touch events
     point0.x = 20;
     point0.y = 0;
     myPanel = new Panel(context,R.drawable.green_panel, point0);
}

@Override
protected void onDraw(Canvas canvas) {
     canvas.drawBitmap(myPanel.getBitmap(), myPanel.getX(),
myPanel.getY() , null);
}

public boolean onTouchEvent(MotionEvent event) {
     myPanel.animateMe();
     invalidate();
     return true;
}
}


PANEL CLASS:

public class Panel extends View {
private Bitmap img; // the image of the panel
private int coordX = 0; // the x coordinate at the canvas
private int coordY = 0; // the y coordinate at the canvas
private RotateAnimation anim2 = null;

public Panel(Context context, int drawable, Point point) {
     super(context);
     BitmapFactory.Options opts = new BitmapFactory.Options();
     opts.inJustDecodeBounds = true;
     img = BitmapFactory.decodeResource(context.getResources(),
drawable);
     coordX = point.x;
     coordY = point.y;
}

public void animateMe (){
     anim2=new RotateAnimation(0.0f, 90.0f);
     anim2.setDuration(1000);
     anim2.setInterpolator(new AccelerateInterpolator(1.0f));
     startAnimation(anim2);

}

public int getX() {
    return coordX;
}

public int getY() {
     return coordY;
}
public Bitmap getBitmap() {
     return img;
}
}
--~--~---------~--~----~------------~-------~--~----~

2. GLES applications sometimes crashes "(SIGSEGV), fault addr 00000150" after turning screen off/on

Hello!

We are developing an application for a customer on new hardware and
have an issue with crashes/blinking/freezing when running GL
applications.

What is worrying is that we recently discovered that this error is
reproducible not only when running our own program on the customer's
device, but also when running the APIDemos sample (that comes with
android-sdk-windows-1.5_r3) on a regular Android developer phone
(flashed with Android 1.5).

To reproduce this crash we ran the APIdemos application on the dev
phone, navigated to Graphics->OpenGL ES, and started the Kube
application (any app in that menu will do). Then, in a very rapid
fashion, press the Off button on the device, followed by two presses
on the menu button to turn the device back on (or two presses on the
off button followed by one on the menu button). Repeat this n times
(sometimes 100 tries, sometimes 10...) quickly and irregularly
(basically, press off/menu buttons randomly). What happens eventually
is that we either get a crash (see below), or we see that the kube
application is either frozen or "blinking" (switches between two
previous frame back and forth). If, at this point, we turn the device
off again, eglTerminate is called by the system which then causes the
crash.

Pressing lots of buttons quickly over and over to cause a crash might
seem like a bit of a pseudo issue but this is only a quick way of
reproducing an issue that happens anyway from time to time when
running a GL app (e.g. sometimes when leaving a GL app causing the
screen to turn off automatically and later pressing the menu button to
turn it on again, this can (though rarely) happen.)

The crash output typically looks like this:

D/EGL     (13060): CONTEXT_LOST: Releasing GPU upon request from
SurfaceFlinger.
D/EGL.oem (13060): SMI  region at virtual=0x458a8000, physical=0x0,
size=7340032 offset=0
D/EGL.oem (13060): EBI1 region at virtual=0x45fa8000,
physical=0x16500000, size=8388608 offset=1228800
D/EGL.oem (13060): REGS region at virtual=0x457a8000,
physical=0xa0000000, size=1048576, offset=0
D/WindowManager(   60): I'm tired mEndcallBehavior=0x2
D/GLLogger(13060): 0: eglInitialize() failed (EGL_CONTEXT_LOST)
I/ARMAssembler(13060): generated
scanline__00000097:03010104_00000000_00000000 [ 12 ipp] (43 ins) at
[0x2cc3f0:0x2cc49c] in 2380374 ns
D/KeyguardViewMediator(   60): wakeWhenReadyLocked(6)
D/KeyguardViewMediator(   60): handleWakeWhenReady(6)
D/KeyguardViewMediator(   60): pokeWakelock(5000)
I/DEBUG   ( 4078): *** *** *** *** *** *** *** *** *** *** *** *** ***
*** *** *
**
I/DEBUG   ( 4078): Build fingerprint: 'android-devphone1/
dream_devphone/dream/tr
out:1.5/CRB21/147201:userdebug/adp,test-keys'
I/DEBUG   ( 4078): pid: 13060, tid: 13098  >>>com.example.android.apis
<<<
I/DEBUG   ( 4078): signal 11 (SIGSEGV), fault addr 00000150
I/DEBUG   ( 4078):  r0 00000000  r1 4570fd38  r2 00000001  r3 00000000
I/DEBUG   ( 4078):  r4 002c7e70  r5 002c7e70  r6 ac708c74  r7 ac708ad0
I/DEBUG   ( 4078):  r8 4570fda0  r9 41046f60  10 41046f4c  fp 00000001
I/DEBUG   ( 4078):  ip ac708bcc  sp 4570fd38  lr 80442a2c  pc
80416790  cpsr 60000010
I/DEBUG   ( 4078):          #00  pc 00016790  /system/lib/libhgl.so
I/DEBUG   ( 4078):          #01  lr 80442a2c  /system/lib/libhgl.so
I/DEBUG   ( 4078): stack:
I/DEBUG   ( 4078):     4570fcf8  002cc168  [heap]
I/DEBUG   ( 4078):     4570fcfc  afe0e940  /system/lib/libc.so
I/DEBUG   ( 4078):     4570fd00  002c8338  [heap]
I/DEBUG   ( 4078):     4570fd04  afe0e940  /system/lib/libc.so
I/DEBUG   ( 4078):     4570fd08  00002bb0
...
D/SurfaceFlinger(   60): Screen about to return, flinger = 0x1841c8
I/ActivityManager(   60): Process com.example.android.apis (pid 13060)
has died.
I/WindowManager(   60): WIN DEATH: Window{4381ba80 SurfaceView
paused=false}


The faulty address is always the same (00000150). It seems to be
related to EGL_CONTEXT_LOST and eglInitialize failing.

We have tried waiting for the context to return (surfaceCreated), but
it never happens at this point. Trying to call eglInitialize
repeatedly fails indefinitely.


We do not know how to proceed with this problem at this point, and
would be very thankful for some help or input. Does loss of context
sometimes have to be treated in some manner we are not aware of? Is it
possible that the APIdemos sample has omitted to take care of this
special case as well?


Note: Our own code, as well as the APIdemos 1.1 code, calls
eglInitialize and eglTerminate explicitly. In ApiDemos for 1.5, this
seems to have been overtaken by the GLSurfaceView class. However, the
crash log output looks exactly the same when running ApiDemos for 1.5,
even the complaints about eglInitialize failing is the same, so I am
assuming the above-mentioned methods are called implicitly.


------------------------------------------------------------------------------------
Mikael Sollenborn @ The Astonishing Tribe

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. Ressource Management / Priorization of applications?

4. Load of applications in RAM

5. Resizing dialog window does not work

6. Intent.ACTION_SEND problems with platform\emulator 1.1

7. setPadding() in onDraw() causing ListView draw loop