Skip to content

Commit

Permalink
Bug 694795: Black rectangle in top left corner after opening a link f…
Browse files Browse the repository at this point in the history
…rom another app. r=mbrubeck a=akeybl
  • Loading branch information
Fabrice Desre committed Nov 15, 2011
1 parent fa52015 commit 65b3b69
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
12 changes: 9 additions & 3 deletions embedding/android/GeckoApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,6 @@ public void run() {
0,
0));

// Some phones (eg. nexus S) need at least a 8x16 preview size
mainLayout.addView(cameraView, new AbsoluteLayout.LayoutParams(8, 16, 0, 0));

setContentView(mainLayout,
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT));
Expand Down Expand Up @@ -427,6 +424,15 @@ public void run() {
mLibLoadThread.start();
}

public void enableCameraView() {
// Some phones (eg. nexus S) need at least a 8x16 preview size
mainLayout.addView(cameraView, new AbsoluteLayout.LayoutParams(8, 16, 0, 0));
}

public void disableCameraView() {
mainLayout.removeView(cameraView);
}

@Override
protected void onNewIntent(Intent intent) {
if (checkLaunchState(LaunchState.GeckoExiting)) {
Expand Down
15 changes: 15 additions & 0 deletions embedding/android/GeckoAppShell.java
Original file line number Diff line number Diff line change
Expand Up @@ -1535,6 +1535,14 @@ public static void postToJavaThread(boolean mainThread) {
static int[] initCamera(String aContentType, int aCamera, int aWidth, int aHeight) {
Log.i("GeckoAppJava", "initCamera(" + aContentType + ", " + aWidth + "x" + aHeight + ") on thread " + Thread.currentThread().getId());

getMainHandler().post(new Runnable() {
public void run() {
try {
GeckoApp.mAppContext.enableCameraView();
} catch (Exception e) {}
}
});

// [0] = 0|1 (failure/success)
// [1] = width
// [2] = height
Expand Down Expand Up @@ -1622,6 +1630,13 @@ public void onPreviewFrame(byte[] data, android.hardware.Camera camera) {

static synchronized void closeCamera() {
Log.i("GeckoAppJava", "closeCamera() on thread " + Thread.currentThread().getId());
getMainHandler().post(new Runnable() {
public void run() {
try {
GeckoApp.mAppContext.disableCameraView();
} catch (Exception e) {}
}
});
if (sCamera != null) {
sCamera.stopPreview();
sCamera.release();
Expand Down

0 comments on commit 65b3b69

Please sign in to comment.