Example usage for java.lang VerifyError getMessage

List of usage examples for java.lang VerifyError getMessage

Introduction

In this page you can find the example usage for java.lang VerifyError getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.apache.bsf.util.event.generator.EventAdapterGenerator.java

public static Class makeEventAdapterClass(Class listenerType, boolean writeClassFile) {
    logger.info("EventAdapterGenerator");

    if (EVENTLISTENER.isAssignableFrom(listenerType)) {
        boolean exceptionable = false;
        boolean nonExceptionable = false;
        byte constantPool[] = null;
        short cpBaseIndex;
        short cpCount = 0;
        short cpExceptionBaseIndex;
        short exceptionableCount;
        short nonExceptionableCount;

        /* Derive Names */
        String listenerTypeName = listenerType.getName();
        logger.info("ListenerTypeName: " + listenerTypeName);
        String adapterClassName = CLASSPACKAGE + (listenerTypeName.endsWith("Listener")
                ? listenerTypeName.substring(0, listenerTypeName.length() - 8)
                : listenerTypeName).replace('.', '_') + "Adapter";
        String finalAdapterClassName = adapterClassName;
        Class cached = null;//from  ww  w .  j  a  va2  s  .  c om
        int suffixIndex = 0;

        do {
            if (null != (cached = ldr.getLoadedClass(finalAdapterClassName))) {
                logger.info("cached:  " + cached);
                try {
                    if (!listenerType.isAssignableFrom(cached))
                        finalAdapterClassName = adapterClassName + "_" + suffixIndex++;
                    else
                        return cached;
                } catch (VerifyError ex) {
                    System.err.println(ex.getMessage());
                    ex.printStackTrace();
                    return cached;
                }
            }
        } while (cached != null);

        String eventListenerName = listenerTypeName.replace('.', '/');

        /* method stuff */
        java.lang.reflect.Method lms[] = listenerType.getMethods();

        /* ****************************************************************************************** */
        // Listener interface
        // Class name
        cpCount += 4;

        // cp item 17
        constantPool = Bytecode.addUtf8(constantPool, eventListenerName);

        // cp item 18
        constantPool = Bytecode.addUtf8(constantPool, finalAdapterClassName);

        // cp item 19
        constantPool = Bytecode.addClass(constantPool, (short) 17);

        // cp item 20
        constantPool = Bytecode.addClass(constantPool, (short) 18);

        // do we have nonExceptionalble event, exceptionable or both
        for (int i = 0; i < lms.length; ++i) {
            Class exceptionTypes[] = lms[i].getExceptionTypes();
            if (0 < exceptionTypes.length) {
                exceptionable = true;
            } else {
                nonExceptionable = true;
            }
        } /* End for*/

        /* ****************************************************************************************** */
        // optional inclusion of nonexceptional events affects exceptional events indices

        nonExceptionableCount = 0;
        if (nonExceptionable) {
            nonExceptionableCount = 3;
            cpCount += nonExceptionableCount;

            // cp item 21
            constantPool = Bytecode.addUtf8(constantPool, "processEvent");

            // cp item 22
            constantPool = Bytecode.addNameAndType(constantPool, (short) 21, (short) 8);

            // cp item 23
            constantPool = Bytecode.addInterfaceMethodRef(constantPool, (short) 12, (short) 22);
        }

        /* ****************************************************************************************** */
        // optional inclusion of exceptional events affects CP Items which follow for specific methods

        exceptionableCount = 0;
        if (exceptionable) {
            int classIndex = BASECPCOUNT + cpCount + 1;
            int nameIndex = BASECPCOUNT + cpCount + 0;
            int natIndex = BASECPCOUNT + cpCount + 3;

            exceptionableCount = 5;
            cpCount += exceptionableCount;

            // cp item 24 or 21
            constantPool = Bytecode.addUtf8(constantPool, "processExceptionableEvent");

            // cp item 25 or 22
            constantPool = Bytecode.addUtf8(constantPool, "java/lang/Exception");

            // cp item 26 or 23
            constantPool = Bytecode.addClass(constantPool, (short) classIndex);

            // cp item 27 or 24
            constantPool = Bytecode.addNameAndType(constantPool, (short) nameIndex, (short) 8);

            // cp item 28 or 25
            constantPool = Bytecode.addInterfaceMethodRef(constantPool, (short) 12, (short) natIndex);

        }

        // base index for method cp references
        cpBaseIndex = (short) (BASECPCOUNT + cpCount);
        logger.debug("cpBaseIndex: " + cpBaseIndex);

        for (int i = 0; i < lms.length; ++i) {
            String eventMethodName = lms[i].getName();
            String eventName = lms[i].getParameterTypes()[0].getName().replace('.', '/');
            cpCount += 3;
            // cp items for event methods
            constantPool = Bytecode.addUtf8(constantPool, eventMethodName);
            constantPool = Bytecode.addUtf8(constantPool, ("(L" + eventName + ";)V"));
            constantPool = Bytecode.addString(constantPool, (short) (BASECPCOUNT + cpCount - 3));
        } /* End for*/

        boolean propertyChangeFlag[] = new boolean[lms.length];
        int cpIndexPCE = 0;
        for (int i = 0; i < lms.length; ++i) {
            String eventName = lms[i].getParameterTypes()[0].getName().replace('.', '/');
            // cp items for PropertyChangeEvent special handling
            if (eventName.equalsIgnoreCase("java/beans/PropertyChangeEvent")) {
                propertyChangeFlag[i] = true;
                if (0 == cpIndexPCE) {
                    constantPool = Bytecode.addUtf8(constantPool, eventName);
                    constantPool = Bytecode.addUtf8(constantPool, "getPropertyName");
                    constantPool = Bytecode.addUtf8(constantPool, "()Ljava/lang/String;");
                    constantPool = Bytecode.addClass(constantPool, (short) (BASECPCOUNT + cpCount));
                    constantPool = Bytecode.addNameAndType(constantPool, (short) (BASECPCOUNT + cpCount + 1),
                            (short) (BASECPCOUNT + cpCount + 2));
                    constantPool = Bytecode.addMethodRef(constantPool, (short) (BASECPCOUNT + cpCount + 3),
                            (short) (BASECPCOUNT + cpCount + 4));
                    cpCount += 6;
                    cpIndexPCE = BASECPCOUNT + cpCount - 1;

                }
            } else {
                propertyChangeFlag[i] = false;
            }
        } /* End for*/

        cpExceptionBaseIndex = (short) (BASECPCOUNT + cpCount);
        logger.debug("cpExceptionBaseIndex: " + cpExceptionBaseIndex);

        int excpIndex[][] = new int[lms.length][];
        for (int i = 0; i < lms.length; ++i) {
            Class exceptionTypes[] = lms[i].getExceptionTypes();
            excpIndex[i] = new int[exceptionTypes.length];
            for (int j = 0; j < exceptionTypes.length; j++) {
                constantPool = Bytecode.addUtf8(constantPool, exceptionTypes[j].getName().replace('.', '/'));
                constantPool = Bytecode.addClass(constantPool, (short) (BASECPCOUNT + cpCount));
                excpIndex[i][j] = BASECPCOUNT + cpCount + 1;
                cpCount += 2;
            }
        } /* End for*/
        /* end constant pool */

        /* ************************************************************************************************ */
        // put the Class byte array together

        /* start */
        byte newClass[] = CLASSHEADER; // magic, version      (fixed)
        short count = (short) (BASECPCOUNT + cpCount);
        newClass = ByteUtility.addBytes(newClass, count); // constant_pool_count (variable)
        newClass = ByteUtility.addBytes(newClass, BASECP); // constant_pool       (fixed)
        newClass = ByteUtility.addBytes(newClass, constantPool); // constant_pool       (variable)
        newClass = ByteUtility.addBytes(newClass, FIXEDCLASSBYTES); // see FIXEDCLASSBYTES (fixed)
        newClass = ByteUtility.addBytes(newClass, (short) (lms.length + 1)); // method_count        (variable)
        newClass = ByteUtility.addBytes(newClass, INITMETHOD); // constructor <init>  (fixed)
        // methods

        /* ****************************************************************************************** */
        /* loop over listener methods from listenerType */
        for (int i = 0; i < lms.length; ++i) {
            newClass = ByteUtility.addBytes(newClass, (short) 1); // access_flags             (fixed)
            newClass = ByteUtility.addBytes(newClass, (short) (cpBaseIndex + 3 * i + 0)); // name_index               (variable)
            newClass = ByteUtility.addBytes(newClass, (short) (cpBaseIndex + 3 * i + 1)); // descriptor_index         (variable)
            newClass = ByteUtility.addBytes(newClass, (short) 1); // attribute_count          (fixed)
            newClass = ByteUtility.addBytes(newClass, (short) 3); // attribute_name_index code(fixed)

            // Code Attribute Length
            int length = 32;
            if (0 < excpIndex[i].length) {
                length += 5 + 8 * (1 + excpIndex[i].length);
            }
            if (propertyChangeFlag[i]) {
                length += 2;
            }
            newClass = ByteUtility.addBytes(newClass, (long) length); // attribute_length         (variable)

            // start code attribute
            newClass = ByteUtility.addBytes(newClass, (short) 6); // max_stack                (fixed)
            newClass = ByteUtility.addBytes(newClass, (short) 3); // max_locals               (fixed)

            // Code Length
            length = 20;
            if (exceptionable && 0 < excpIndex[i].length) {
                length += 5;
            }
            if (propertyChangeFlag[i]) {
                length += 2;
            }
            newClass = ByteUtility.addBytes(newClass, (long) length); // code_length              (variable)

            // start code
            newClass = ByteUtility.addBytes(newClass, (byte) 0x2A); // aload_0                  (fixed)
            newClass = ByteUtility.addBytes(newClass, (byte) 0xB4); // getfield                 (fixed)
            newClass = ByteUtility.addBytes(newClass, (short) 15); // index                    (fixed)

            if (propertyChangeFlag[i]) { // the propertyName is passed as the first parameter
                newClass = ByteUtility.addBytes(newClass, (byte) 0x2B); // aload_1                  (fixed)
                newClass = ByteUtility.addBytes(newClass, (byte) 0xB6); // invokevirtual            (fixed)
                newClass = ByteUtility.addBytes(newClass, (short) cpIndexPCE); // methodref                (variable)
            } else { // the eventMethodName is passed as the first parameter
                     // Target for method invocation.
                newClass = ByteUtility.addBytes(newClass, (byte) 0x12); // ldc                    (fixed)
                newClass = ByteUtility.addBytes(newClass, (byte) (cpBaseIndex + 3 * i + 2)); // index (byte)           (variable)
            }

            newClass = ByteUtility.addBytes(newClass, (byte) 0x04); // iconst_1                 (fixed)
            newClass = ByteUtility.addBytes(newClass, (byte) 0xBD); // anewarray                (fixed)
            newClass = ByteUtility.addBytes(newClass, (short) 10); // Class java/lang/Object   (fixed)
            newClass = ByteUtility.addBytes(newClass, (byte) 0x59); // dup                      (fixed)
            newClass = ByteUtility.addBytes(newClass, (byte) 0x03); // iconst_0                 (fixed)
            newClass = ByteUtility.addBytes(newClass, (byte) 0x2B); // aload_1                  (fixed)
            newClass = ByteUtility.addBytes(newClass, (byte) 0x53); // aastore                  (fixed)
            newClass = ByteUtility.addBytes(newClass, (byte) 0xB9); // invokeinterface          (fixed)

            // index to processEvent or processExceptionableEvent method
            length = 23; // actually an index into cp
            if (exceptionable && nonExceptionable) { // interface method index
                if (0 < lms[i].getExceptionTypes().length) {
                    length += 5;
                }
            } else if (exceptionable) {
                length += 2;
            }
            newClass = ByteUtility.addBytes(newClass, (short) length); // index (process??????...) (variable)

            newClass = ByteUtility.addBytes(newClass, (byte) 0x03); // iconst_0                 (fixed)
            newClass = ByteUtility.addBytes(newClass, (byte) 0x00); // noop                     (fixed)
            newClass = ByteUtility.addBytes(newClass, (byte) 0xB1); // return                   (fixed)

            if (exceptionable && 0 < excpIndex[i].length) { // exception code
                newClass = ByteUtility.addBytes(newClass, (byte) 0x4D); // astore_2                 (fixed)
                newClass = ByteUtility.addBytes(newClass, (byte) 0x2C); // aload_2                  (fixed)
                newClass = ByteUtility.addBytes(newClass, (byte) 0xBF); // athrow                   (fixed)
                newClass = ByteUtility.addBytes(newClass, (byte) 0x57); // pop                      (fixed)
                newClass = ByteUtility.addBytes(newClass, (byte) 0xB1); // return                   (fixed)
                // end code

                // exception table
                length = excpIndex[i].length;
                newClass = ByteUtility.addBytes(newClass, (short) (1 + length)); // exception_table_length   (variable)
                for (int j = 0; j < length; j++) { // catch exception types and rethrow
                    newClass = ByteUtility.addBytes(newClass, (short) 0); // start_pc                 (fixed)
                    if (propertyChangeFlag[i]) {
                        newClass = ByteUtility.addBytes(newClass, (short) 21); // end_pc                   (fixed)
                        newClass = ByteUtility.addBytes(newClass, (short) 22); // handler_pc               (fixed)
                    } else {
                        newClass = ByteUtility.addBytes(newClass, (short) 19); // end_pc                   (fixed)
                        newClass = ByteUtility.addBytes(newClass, (short) 20); // handler_pc               (fixed)
                    }
                    newClass = ByteUtility.addBytes(newClass, (short) excpIndex[i][j]); // catch_type               (variable)
                }
                // catch "exception" and trap it
                newClass = ByteUtility.addBytes(newClass, (short) 0); // start_pc                 (fixed)
                if (propertyChangeFlag[i]) {
                    newClass = ByteUtility.addBytes(newClass, (short) 21); // end_pc                   (fixed)
                    newClass = ByteUtility.addBytes(newClass, (short) 25); // handler_pc               (fixed)
                } else {
                    newClass = ByteUtility.addBytes(newClass, (short) 19); // end_pc                   (fixed)
                    newClass = ByteUtility.addBytes(newClass, (short) 23); // handler_pc               (fixed)
                }
                if (nonExceptionable) {
                    newClass = ByteUtility.addBytes(newClass, (short) 26);
                } // catch_type               (fixed)
                else // or
                {
                    newClass = ByteUtility.addBytes(newClass, (short) 23);
                } // catch_type               (fixed)
            } else {
                newClass = ByteUtility.addBytes(newClass, (short) 0);
            } // exception_table_length   (fixed)
            // attributes on the code attribute (none)
            newClass = ByteUtility.addBytes(newClass, (short) 0); // attribute_count          (fixed)
            // end code attribute

        } /* End for*/
        // Class Attributes (none for this)
        newClass = ByteUtility.addBytes(newClass, (short) 0); // attribute_count          (fixed)
        /* done */

        logger.debug("adapterName: " + finalAdapterClassName);
        logger.debug("cpCount: " + count + " = " + BASECPCOUNT + " + " + cpCount);
        logger.debug("methodCount: " + (lms.length + 1));
        // output to disk class file
        /* ****************************************************************************************** */

        // now create the class and load it
        // return the Class.

        if (writeClassFile) {
            try {
                // removed "WRITEDIRECTORY+", as this path is already part of 'finalAdapterClassName'
                FileOutputStream fos = new FileOutputStream(finalAdapterClassName + ".class");
                fos.write(newClass);
                fos.close();
            } catch (IOException ex) {
                System.err.println(ex.getMessage());
                ex.printStackTrace();
            }

            try {
                Class ret = ldr.loadClass(finalAdapterClassName);
                logger.debug("EventAdapterGenerator: " + ret.getName() + " dynamically generated");
                return ret;
            } catch (ClassNotFoundException ex) {
                System.err.println(ex.getMessage());
                ex.printStackTrace();
            }
        }

        try {
            Class ret = ldr.defineClass(finalAdapterClassName, newClass);
            logger.debug("EventAdapterGenerator: " + ret.getName() + " dynamically generated");
            return ret;
        } catch (Exception ex) {
            System.err.println(ex.getMessage());
            ex.printStackTrace();
        }
    }
    return null;
}

From source file:com.almalence.opencam.ApplicationScreen.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    sEvPref = getResources().getString(R.string.Preference_EvCompensationValue);
    sSceneModePref = getResources().getString(R.string.Preference_SceneModeValue);
    sWBModePref = getResources().getString(R.string.Preference_WBModeValue);
    sColorTemperaturePref = getResources().getString(R.string.Preference_ColorTemperatureValue);
    sFrontFocusModePref = getResources().getString(R.string.Preference_FrontFocusModeValue);
    sFrontFocusModeVideoPref = getResources().getString(R.string.Preference_FrontFocusModeVideoValue);
    sRearFocusModePref = getResources().getString(R.string.Preference_RearFocusModeValue);
    sRearFocusModeVideoPref = getResources().getString(R.string.Preference_RearFocusModeVideoValue);
    sFrontColorEffectPref = getResources().getString(R.string.Preference_FrontColorEffectValue);
    sRearColorEffectPref = getResources().getString(R.string.Preference_RearColorEffectValue);
    sFlashModePref = getResources().getString(R.string.Preference_FlashModeValue);
    sISOPref = getResources().getString(R.string.Preference_ISOValue);
    sMeteringModePref = getResources().getString(R.string.Preference_MeteringModeValue);
    sExposureTimePref = getResources().getString(R.string.Preference_ExposureTimeValue);
    sExposureTimeModePref = getResources().getString(R.string.Preference_ExposureTimeModeValue);
    sRealExposureTimeOnPreviewPref = getResources()
            .getString(R.string.Preference_RealExposureTimeOnPreviewValue);
    sFocusDistancePref = getResources().getString(R.string.Preference_FocusDistanceValue);
    sFocusDistanceModePref = getResources().getString(R.string.Preference_FocusDistanceModeValue);
    sCameraModePref = getResources().getString(R.string.Preference_CameraModeValue);

    sUseFrontCameraPref = getResources().getString(R.string.Preference_UseFrontCameraValue);

    sImageSizeRearPref = getResources().getString(R.string.Preference_ImageSizeRearValue);
    sImageSizeFrontPref = getResources().getString(R.string.Preference_ImageSizeFrontValue);
    sImageSizeSonyRemotePref = getResources().getString(R.string.Preference_ImageSizeSonyRemoteValue);

    sImageSizeMultishotBackPref = getResources()
            .getString(R.string.Preference_ImageSizePrefSmartMultishotBackValue);
    sImageSizeMultishotFrontPref = getResources()
            .getString(R.string.Preference_ImageSizePrefSmartMultishotFrontValue);
    sImageSizeMultishotSonyRemotePref = getResources()
            .getString(R.string.Preference_ImageSizePrefSmartMultishotSonyRemoteValue);

    sImageSizePanoramaBackPref = getResources().getString(R.string.Preference_ImageSizePrefPanoramaBackValue);
    sImageSizePanoramaFrontPref = getResources().getString(R.string.Preference_ImageSizePrefPanoramaFrontValue);

    sImageSizeVideoBackPref = getResources().getString(R.string.Preference_ImageSizePrefVideoBackValue);
    sImageSizeVideoFrontPref = getResources().getString(R.string.Preference_ImageSizePrefVideoFrontValue);

    sCaptureRAWPref = getResources().getString(R.string.Preference_CaptureRAWValue);

    sJPEGQualityPref = getResources().getString(R.string.Preference_JPEGQualityCommonValue);

    sAntibandingPref = getResources().getString(R.string.Preference_AntibandingValue);

    sExportNamePref = getResources().getString(R.string.Preference_ExportNameValue);
    sExportNameSeparatorPref = getResources().getString(R.string.Preference_ExportNameSeparatorValue);
    sExportNamePrefixPref = getResources().getString(R.string.Preference_SavePathPrefixValue);
    sExportNamePostfixPref = getResources().getString(R.string.Preference_SavePathPostfixValue);
    sSavePathPref = getResources().getString(R.string.Preference_SavePathValue);
    sSaveToPref = getResources().getString(R.string.Preference_SaveToValue);
    sSortByDataPref = getResources().getString(R.string.Preference_SortByDataValue);
    sEnableExifOrientationTagPref = getResources().getString(R.string.Preference_EnableExifTagOrientationValue);
    sAdditionalRotationPref = getResources().getString(R.string.Preference_AdditionalRotationValue);
    sUseGeotaggingPref = getResources().getString(R.string.Preference_UseGeotaggingValue);

    sTimestampDate = getResources().getString(R.string.Preference_TimestampDateValue);
    sTimestampAbbreviation = getResources().getString(R.string.Preference_TimestampAbbreviationValue);
    sTimestampTime = getResources().getString(R.string.Preference_TimestampTimeValue);
    sTimestampGeo = getResources().getString(R.string.Preference_TimestampGeoValue);
    sTimestampSeparator = getResources().getString(R.string.Preference_TimestampSeparatorValue);
    sTimestampCustomText = getResources().getString(R.string.Preference_TimestampCustomTextValue);
    sTimestampColor = getResources().getString(R.string.Preference_TimestampColorValue);
    sTimestampFontSize = getResources().getString(R.string.Preference_TimestampFontSizeValue);

    sAELockPref = getResources().getString(R.string.Preference_AELockValue);
    sAWBLockPref = getResources().getString(R.string.Preference_AWBLockValue);

    sExpoPreviewModePref = getResources().getString(R.string.Preference_ExpoBracketingPreviewModePref);

    sDefaultModeName = getResources().getString(R.string.Preference_DefaultModeName);

    mainContext = this.getBaseContext();
    messageHandler = new Handler(this);
    instance = this;

    surfaceCreated = false;//from www  .  jav  a 2 s. c  o  m

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    // ensure landscape orientation
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    // set to fullscreen
    getWindow().addFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
                    | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);

    // set some common view here
    //      setContentView(R.layout.opencamera_main_layout);

    createPluginManager();
    duringOnCreate();

    try {
        cameraController = CameraController.getInstance();
    } catch (VerifyError exp) {
        Log.e("ApplicationScreen", exp.getMessage());
    }
    CameraController.onCreate(ApplicationScreen.instance, ApplicationScreen.instance, pluginManager,
            ApplicationScreen.instance.messageHandler);

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ApplicationScreen.getMainContext());
    keepScreenOn = prefs.getBoolean("keepScreenOn", false);

    // set preview, on click listener and surface buffers
    //      findViewById(R.id.SurfaceView02).setVisibility(View.GONE);
    //      preview = (SurfaceView) this.findViewById(R.id.SurfaceView01);
    //      preview.setOnClickListener(this);
    //      preview.setOnTouchListener(this);
    //      preview.setKeepScreenOn(true);
    //
    //      surfaceHolder = preview.getHolder();
    //      surfaceHolder.addCallback(this);

    orientListener = new OrientationEventListener(this) {
        @Override
        public void onOrientationChanged(int orientation) {
            // figure landscape or portrait
            if (ApplicationScreen.instance.landscapeIsNormal) {
                orientation += 90;
            }

            if ((orientation < 45) || (orientation > 315 && orientation < 405)
                    || ((orientation > 135) && (orientation < 225))) {
                if (ApplicationScreen.wantLandscapePhoto) {
                    ApplicationScreen.wantLandscapePhoto = false;
                }
            } else {
                if (!ApplicationScreen.wantLandscapePhoto) {
                    ApplicationScreen.wantLandscapePhoto = true;
                }
            }

            // orient properly for video
            if ((orientation > 135) && (orientation < 225))
                orientationMain = 270;
            else if ((orientation < 45) || (orientation > 315))
                orientationMain = 90;
            else if ((orientation < 325) && (orientation > 225))
                orientationMain = 0;
            else if ((orientation < 135) && (orientation > 45))
                orientationMain = 180;

            if (orientationMain != orientationMainPrevious) {
                orientationMainPrevious = orientationMain;
            }
        }
    };

    // prevent power drain
    screenTimer = new CountDownTimer(180000, 180000) {
        public void onTick(long millisUntilFinished) {
            // Not used
        }

        public void onFinish() {
            boolean isVideoRecording = PreferenceManager
                    .getDefaultSharedPreferences(ApplicationScreen.getMainContext())
                    .getBoolean("videorecording", false);
            if (isVideoRecording || keepScreenOn) {
                // restart timer
                screenTimer.start();
                isScreenTimerRunning = true;
                if (preview != null) {
                    preview.setKeepScreenOn(true);
                }
                return;
            }
            if (preview != null) {
                preview.setKeepScreenOn(keepScreenOn);
            }
            isScreenTimerRunning = false;
        }
    };
    screenTimer.start();
    isScreenTimerRunning = true;

    if (this.getIntent().getAction() != null) {
        if (this.getIntent().getAction().equals(MediaStore.ACTION_IMAGE_CAPTURE)) {
            try {
                forceFilenameUri = this.getIntent().getExtras().getParcelable(MediaStore.EXTRA_OUTPUT);
                ApplicationScreen.setForceFilename(new File(((Uri) forceFilenameUri).getPath()));
                if (ApplicationScreen.getForceFilename().getAbsolutePath().equals("/scrapSpace")) {
                    ApplicationScreen.setForceFilename(
                            new File(Environment.getExternalStorageDirectory().getAbsolutePath()
                                    + "/mms/scrapSpace/.temp.jpg"));
                    new File(ApplicationScreen.getForceFilename().getParent()).mkdirs();
                }
            } catch (Exception e) {
                ApplicationScreen.setForceFilename(null);
            }
        } else {
            ApplicationScreen.setForceFilename(null);
        }
    } else {
        ApplicationScreen.setForceFilename(null);
    }

    afterOnCreate();
}