The buffer queue has been abandoned

I am writing an application to make a flashlight lit an LED on an Android device. Most of the time this works well, but sometimes I see the message "E / BufferQueueProducer: [unnamed-5260-0] queueBuffer: BufferQueue has been abandoned" in logCat.

After that, the app will not be able to light up the device LED. It can take control of the LED again when the orientation changes ... rather strange. I made a lot of changes, but the only thing I can do is screw it in completely so it can never light up with an LED.

Could you please help me with this problem?

I am attaching a .java and logCat file corresponding to this problem.

package com.spc.acrux.linterna;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.SurfaceTexture;
import android.hardware.Camera;
import android.hardware.Camera.Parameters;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.apptracker.android.track.AppTracker;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.InterstitialAd;

import java.io.IOException;


public class MainActivity extends ActionBarActivity {
    // Remove the below line after defining your own ad unit ID.
    //private static final String TOAST_TEXT = "Test ads are being shown. "
    //        + "To show live ads, replace the ad unit ID in res/values/strings.xml with your own ad unit ID.";

    private static final int START_LEVEL = 1;
    private int mLevel;
    private Button mNextLevelButton;
    private InterstitialAd mInterstitialAd;
    private TextView mLevelTextView;
    private Camera camera;
    //flag to detect flash is on or off
    private boolean isLighOn = false;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        // For LeadBolt
        if(savedInstanceState == null) {
            // Initialize Leadbolt SDK with your api key
            AppTracker.startSession(getApplicationContext(), "hhxSJ6GsjLqcGFQgIA7zunbhKe5NbX1k");
        }
        // cache Leadbolt Ad without showing it
        AppTracker.loadModuleToCache(getApplicationContext(),"inapp");



    // Mostrar un anuncio
       AdView mAdView = (AdView) findViewById(R.id.adView);
        AdRequest adRequest = new AdRequest.Builder().build();
        mAdView.loadAd(adRequest);



        // Crear el boton ON / OFF
        Button holaPlayerBtn = (Button)findViewById(R.id.buttononoff);

        // call this when you want to display the Leadbolt Interstitial
        AppTracker.loadModule(getApplicationContext(),"inapp");


        Context context = this;
        PackageManager pm = context.getPackageManager();

        // if device support camera?
        if (!pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
            Log.e("err", "Device has no camera!");
            return;
        }

        camera = Camera.open();
        try {
            camera.setPreviewTexture(new SurfaceTexture(0));
        } catch (IOException e) {
            e.printStackTrace();
        }
        final Parameters p = camera.getParameters();

        // Create the next level button, which tries to show an interstitial when clicked.
        mNextLevelButton = ((Button) findViewById(R.id.next_level_button));
        mNextLevelButton.setEnabled(false);
        mNextLevelButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                showInterstitial();
            }
        });

        // Create the text view to show the level number.
        mLevelTextView = (TextView) findViewById(R.id.level);
        mLevel = START_LEVEL;

        // Create the InterstitialAd and set the adUnitId (defined in values/strings.xml).
        mInterstitialAd = new InterstitialAd(this);
        mInterstitialAd.setAdUnitId(getString(R.string.interstitial_ad_unit_id));
        mInterstitialAd.setAdListener(new AdListener() {
            @Override
            public void onAdLoaded() {
                mNextLevelButton.setEnabled(true);
            }

            @Override
            public void onAdFailedToLoad(int errorCode) {
                mNextLevelButton.setEnabled(true);
            }

            @Override
            public void onAdClosed() {
                // Proceed to the next level.
                goToNextLevel();
            }
        });
        loadInterstitial();

        // Toasts the test ad message on the screen. Remove this after defining your own ad unit ID.
        //Toast.makeText(this, TOAST_TEXT, LENGTH_LONG).show();

        //Lo que hace el botón "Hola" que se usa para encender y apagar la linterna
        holaPlayerBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                try {
                    String TEXTO = getString(R.string.pulsaste);
                    Toast.makeText(MainActivity.this, TEXTO, Toast.LENGTH_LONG).show();

                    //Aqui hay que activar el flash y la cámara
                    if (isLighOn) {

                        Log.i("info", "torch is turn off!");

                        p.setFlashMode(Parameters.FLASH_MODE_OFF);
                        camera.setParameters(p);
                        camera.stopPreview();
                        isLighOn = false;

                    } else {

                        Log.i("info", "torch is turn on!");

                        p.setFlashMode(Parameters.FLASH_MODE_TORCH);

                        camera.setParameters(p);
                        camera.startPreview();
                        isLighOn = true;

                    }

                    }

                   catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });


    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.

        switch (item.getItemId()) {
            case R.id.Otras_apps:
                startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pub:\"Pedro Santangelo\"") ) );
                return true;
            case R.id.salir:
               // FlurryAgent.onEndSession(this);
            {
                if (camera != null) {
                    camera.release();
                }

                this.finish();
                return true;
            }
            default:
                return super.onOptionsItemSelected(item);
        }

    }

    private void showInterstitial() {
        // Show the ad if it ready. Oth<string name="otras_apps">Otras Aplicaciones</string>oast and reload the ad.
        if (mInterstitialAd != null && mInterstitialAd.isLoaded()) {
            mInterstitialAd.show();
        } else {
            Toast.makeText(this, getString(R.string.AdError), Toast.LENGTH_SHORT).show();
            goToNextLevel();
        }
    }

    private void loadInterstitial() {
        // Disable the next level button and load the ad.
        mNextLevelButton.setEnabled(false);
        AdRequest adRequest = new AdRequest.Builder().build();
        mInterstitialAd.loadAd(adRequest);
    }

    private void goToNextLevel() {
        // Show the next level and reload the ad to prepare for the level after.
        mLevelTextView.setText(getString(R.string.Nivel) + " " + (++mLevel));
        loadInterstitial();

    }

    //public void activar() {
    //Activar o desactivar la linterna... no se usa ya.
    //    final String TEXTO = "Pulsaste ON / OFF ";
    //    Toast.makeText(this, TEXTO, LENGTH_LONG).show();

    //}

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (camera != null) {
            camera.release();
        }
    }
/*
    @Override
    public void onPause() {
        super.onPause();
        if (camera != null) {
            camera.release();
        }

    }

    @Override
    public void onStop() {
        super.onStop();
        if (camera != null) {
            camera.release();
        }

    }
*/

}

      

===== LogCat looks like this: ========

05-11 19:15:23.515    5260-5260/? I/art﹕ Late-enabling -Xcheck:jni
05-11 19:15:23.751    5260-5260/com.spc.acrux.linterna I/AppTracker﹕ Session started. SDK Version in use 5.1
05-11 19:15:23.756    5260-5260/com.spc.acrux.linterna W/AppTracker﹕ Event listener is not implemented before startSession get called.
05-11 19:15:23.805    5260-5260/com.spc.acrux.linterna I/AppTracker﹕ Loading module with caching enabled for location:inapp
05-11 19:15:23.842    5260-5260/com.spc.acrux.linterna W/ResourcesManager﹕ Asset path '/system/framework/com.android.media.remotedisplay.jar' does not exist or contains no resources.
05-11 19:15:23.842    5260-5260/com.spc.acrux.linterna W/ResourcesManager﹕ Asset path '/system/framework/com.android.location.provider.jar' does not exist or contains no resources.
05-11 19:15:24.011    5260-5260/com.spc.acrux.linterna I/WebViewFactory﹕ Loading com.google.android.webview version 42.0.2311.138 (code 2311138)
05-11 19:15:24.038    5260-5260/com.spc.acrux.linterna I/LibraryLoader﹕ Time to load native libraries: 3 ms (timestamps 8049-8052)
05-11 19:15:24.038    5260-5260/com.spc.acrux.linterna I/LibraryLoader﹕ Expected native library version number "",actual native library version number ""
05-11 19:15:24.057    5260-5260/com.spc.acrux.linterna V/WebViewChromiumFactoryProvider﹕ Binding Chromium to main looper Looper (main, tid 1) {23b24f79}
05-11 19:15:24.057    5260-5260/com.spc.acrux.linterna I/LibraryLoader﹕ Expected native library version number "",actual native library version number ""
05-11 19:15:24.058    5260-5260/com.spc.acrux.linterna I/chromium﹕ [INFO:library_loader_hooks.cc(112)] Chromium logging enabled: level = 0, default verbosity = 0
05-11 19:15:24.072    5260-5260/com.spc.acrux.linterna I/BrowserStartupController﹕ Initializing chromium process, singleProcess=true
05-11 19:15:24.073    5260-5260/com.spc.acrux.linterna W/art﹕ Attempt to remove local handle scope entry from IRT, ignoring
05-11 19:15:24.075    5260-5260/com.spc.acrux.linterna E/SysUtils﹕ ApplicationContext is null in ApplicationStatus
05-11 19:15:24.098    5260-5348/com.spc.acrux.linterna W/AudioManagerAndroid﹕ Requires BLUETOOTH permission
05-11 19:15:24.098    5260-5260/com.spc.acrux.linterna W/chromium﹕ [WARNING:resource_bundle.cc(286)] locale_file_path.empty()
05-11 19:15:24.099    5260-5260/com.spc.acrux.linterna I/chromium﹕ [INFO:aw_browser_main_parts.cc(63)] Load from apk succesful, fd=38 off=57784 len=4071
05-11 19:15:24.101    5260-5260/com.spc.acrux.linterna I/chromium﹕ [INFO:aw_browser_main_parts.cc(76)] Loading webviewchromium.pak from, fd:39 off:7953032 len:1161174
05-11 19:15:24.111    5260-5260/com.spc.acrux.linterna I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 01/14/15, ab0075f, Id3510ff6dc
05-11 19:15:24.178    5260-5260/com.spc.acrux.linterna I/Ads﹕ CsiReporterFactory: CSI is not enabled. No CSI reporter created.
05-11 19:15:24.186    5260-5260/com.spc.acrux.linterna I/Ads﹕ Starting ad request.
05-11 19:15:24.189    5260-5260/com.spc.acrux.linterna I/Ads﹕ Use AdRequest.Builder.addTestDevice("46B876313BCC4B37C16A2B0F9ECCAD83") to get test ads on this device.
05-11 19:15:24.209    5260-5260/com.spc.acrux.linterna I/AppTracker﹕ Loading module for location:inapp
05-11 19:15:24.213    5260-5260/com.spc.acrux.linterna W/AppTracker﹕ No Ad available for location inapp. Please run loadModuleToCache first
05-11 19:15:24.213    5260-5260/com.spc.acrux.linterna E/AppTracker﹕ Module inapp failed to load:ad not ready
05-11 19:15:24.400    5260-5260/com.spc.acrux.linterna I/Ads﹕ Starting ad request.
05-11 19:15:24.400    5260-5260/com.spc.acrux.linterna I/Ads﹕ Use AdRequest.Builder.addTestDevice("46B876313BCC4B37C16A2B0F9ECCAD83") to get test ads on this device.
05-11 19:15:24.423    5260-5428/com.spc.acrux.linterna D/OpenGLRenderer﹕ Use EGL_SWAP_BEHAVIOR_PRESERVED: true
05-11 19:15:24.434    5260-5260/com.spc.acrux.linterna D/Atlas﹕ Validating map...
05-11 19:15:24.475    5260-5428/com.spc.acrux.linterna I/OpenGLRenderer﹕ Initialized EGL, version 1.4
05-11 19:15:24.481    5260-5428/com.spc.acrux.linterna D/OpenGLRenderer﹕ Enabling debug mode 0
05-11 19:15:26.050    5260-5260/com.spc.acrux.linterna I/AppTracker﹕ Module inapp cached successfully.
05-11 19:15:27.554    5260-5361/com.spc.acrux.linterna W/chromium﹕ [WARNING:data_reduction_proxy_config.cc(150)] SPDY proxy OFF at startup
05-11 19:15:27.573    5260-5260/com.spc.acrux.linterna W/art﹕ Attempt to remove local handle scope entry from IRT, ignoring
05-11 19:15:27.590    5260-5260/com.spc.acrux.linterna W/AwContents﹕ onDetachedFromWindow called when already detached. Ignoring
05-11 19:15:27.608    5260-5260/com.spc.acrux.linterna W/art﹕ Attempt to remove local handle scope entry from IRT, ignoring
05-11 19:15:27.608    5260-5260/com.spc.acrux.linterna W/art﹕ Attempt to remove local handle scope entry from IRT, ignoring
05-11 19:15:27.730    5260-5260/com.spc.acrux.linterna W/BindingManager﹕ Cannot call determinedVisibility() - never saw a connection for the pid: 5260
05-11 19:15:27.807    5260-5260/com.spc.acrux.linterna W/art﹕ Attempt to remove local handle scope entry from IRT, ignoring
05-11 19:15:27.809    5260-5260/com.spc.acrux.linterna W/AwContents﹕ onDetachedFromWindow called when already detached. Ignoring
05-11 19:15:27.820    5260-5260/com.spc.acrux.linterna W/art﹕ Attempt to remove local handle scope entry from IRT, ignoring
05-11 19:15:27.820    5260-5260/com.spc.acrux.linterna W/art﹕ Attempt to remove local handle scope entry from IRT, ignoring
05-11 19:15:27.871    5260-5260/com.spc.acrux.linterna W/BindingManager﹕ Cannot call determinedVisibility() - never saw a connection for the pid: 5260
05-11 19:15:29.284    5260-5260/com.spc.acrux.linterna I/Ads﹕ Ad finished loading.
05-11 19:15:30.291    5260-5260/com.spc.acrux.linterna I/Ads﹕ Scheduling ad refresh 30000 milliseconds from now.
05-11 19:15:30.300    5260-5260/com.spc.acrux.linterna I/Ads﹕ Ad finished loading.
05-11 19:15:50.616    5260-5260/com.spc.acrux.linterna I/info﹕ torch is turn on!
05-11 19:15:50.732    5260-5428/com.spc.acrux.linterna V/RenderScript﹕ Application requested CPU execution
05-11 19:15:50.742    5260-5428/com.spc.acrux.linterna V/RenderScript﹕ 0x9c94c800 Launching thread(s), CPUs 4
05-11 19:15:58.265    5260-5260/com.spc.acrux.linterna I/info﹕ torch is turn off!
05-11 19:15:58.808    5260-5260/com.spc.acrux.linterna I/Choreographer﹕ Skipped 32 frames!  The application may be doing too much work on its main thread.
05-11 19:16:00.292    5260-5260/com.spc.acrux.linterna I/Ads﹕ Starting ad request.
05-11 19:16:00.293    5260-5260/com.spc.acrux.linterna I/Ads﹕ Use AdRequest.Builder.addTestDevice("46B876313BCC4B37C16A2B0F9ECCAD83") to get test ads on this device.
05-11 19:16:01.011    5260-5260/com.spc.acrux.linterna W/art﹕ Attempt to remove local handle scope entry from IRT, ignoring
05-11 19:16:01.016    5260-5260/com.spc.acrux.linterna W/AwContents﹕ onDetachedFromWindow called when already detached. Ignoring
05-11 19:16:01.030    5260-5260/com.spc.acrux.linterna W/art﹕ Attempt to remove local handle scope entry from IRT, ignoring
05-11 19:16:01.030    5260-5260/com.spc.acrux.linterna W/art﹕ Attempt to remove local handle scope entry from IRT, ignoring
05-11 19:16:01.096    5260-5260/com.spc.acrux.linterna W/BindingManager﹕ Cannot call determinedVisibility() - never saw a connection for the pid: 5260
05-11 19:16:01.687    5260-5260/com.spc.acrux.linterna I/Ads﹕ Scheduling ad refresh 30000 milliseconds from now.
05-11 19:16:01.690    5260-5260/com.spc.acrux.linterna I/Ads﹕ Ad finished loading.
05-11 19:16:01.747    5260-5260/com.spc.acrux.linterna W/BindingManager﹕ Cannot call determinedVisibility() - never saw a connection for the pid: 5260
05-11 19:16:08.705    5260-5260/com.spc.acrux.linterna I/info﹕ torch is turn on!
05-11 19:16:10.141    5260-5278/com.spc.acrux.linterna E/BufferQueueProducer﹕ [unnamed-5260-0] queueBuffer: BufferQueue has been abandoned
05-11 19:16:10.146    5260-6865/com.spc.acrux.linterna E/BufferQueueProducer﹕ [unnamed-5260-0] dequeueBuffer: BufferQueue has been abandoned
05-11 19:16:10.146    5260-5279/com.spc.acrux.linterna E/BufferQueueProducer﹕ [unnamed-5260-0] dequeueBuffer: BufferQueue has been abandoned
05-11 19:16:10.147    5260-5278/com.spc.acrux.linterna E/BufferQueueProducer﹕ [unnamed-5260-0] dequeueBuffer: BufferQueue has been abandoned
05-11 19:16:10.147    5260-6865/com.spc.acrux.linterna E/BufferQueueProducer﹕ [unnamed-5260-0] dequeueBuffer: BufferQueue has been abandoned
05-11 19:16:10.148    5260-5279/com.spc.acrux.linterna E/BufferQueueProducer﹕ [unnamed-5260-0] dequeueBuffer: BufferQueue has been abandoned
05-11 19:16:10.148    5260-5278/com.spc.acrux.linterna E/BufferQueueProducer﹕ [unnamed-5260-0] dequeueBuffer: BufferQueue has been abandoned
05-11 19:16:10.149    5260-6865/com.spc.acrux.linterna E/BufferQueueProducer﹕ [unnamed-5260-0] dequeueBuffer: BufferQueue has been abandoned

      

+3


source to share





All Articles