How to make an application NOT uninstallable like build-in apps

by Jean-Baptiste Queru » Fri, 06 Mar 2009 05:23:13 GMT


Sponsored Links
 You need to be able to work directly in the system image, i.e. to work
directly with (or to be) a device manufacturer.

JBQ

On Thu, Mar 5, 2009 at 9:27 AM, Explore Android





-- 
Jean-Baptiste M. "JBQ" Queru
Android Engineer, Google.

Questions sent directly to me that have no reason for being private
will likely get ignored or forwarded to a public forum with no further
warning.

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



Other Threads

1. walkin for jave and linux administrators in bangalore

Discuss developing Android applications using the Android framework.
Get help with troubleshooting apps, advice on implementation, and
strategies for improving your app's speed and user experience.
Language: English
19373 members, Messages per month: 4383
www.123maza.com

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

2. Unable to prepare VideoCamera to capture videos

Hello,
Does anyone know how to capture videos with Android VideoRecoder?

I am trying to develop an application that I could use to capture
video. I am
trying to use the MediaRecorder API in 1.5, which is supposed to
support
video capture. However,  I got an error report from prepare() method.
Here are
the initializeVideo settings and the logcat shows:

PS: In order to fix the problem, I suppress the audio recording. And
my sdcard is enabled in the phone.
Thanks for your help!

in packages\apps\Camera\src\com\android\camera\VideoCamera.java

in method initializeVideo

       mMediaRecorder = new MediaRecorder();

        if (DEBUG_SUPPRESS_AUDIO_RECORDING) {
            Log.v(TAG, "DEBUG_SUPPRESS_AUDIO_RECORDING is true."); //
this will be done!
        } else {
            mMediaRecorder.setAudioSource
(MediaRecorder.AudioSource.MIC);
        }
        mMediaRecorder.setVideoSource
(MediaRecorder.VideoSource.CAMERA);

        mMediaRecorder.setOutputFormat
(MediaRecorder.OutputFormat.MPEG_4);

        mMediaRecorder.setMaxDuration(MAX_RECORDING_DURATION_MS);

        if (mStorageStatus != STORAGE_STATUS_OK) {
            mMediaRecorder.setOutputFile("/dev/null");
        } else {
            // We try Uri in intent first. If it doesn't work, use our
own instead.
            if (mCameraVideoFileDescriptor != null) {
                mMediaRecorder.setOutputFile
(mCameraVideoFileDescriptor);
            } else {
                createVideoPath();
                mMediaRecorder.setOutputFile(mCameraVideoFilename);
            }
        }

        boolean videoQualityHigh = getBooleanPreference
(CameraSettings.KEY_VIDEO_QUALITY,
                CameraSettings.DEFAULT_VIDEO_QUALITY_VALUE);

        if (intent.hasExtra(MediaStore.EXTRA_VIDEO_QUALITY)) {
            int extraVideoQuality = intent.getIntExtra
(MediaStore.EXTRA_VIDEO_QUALITY, 0);
            videoQualityHigh = (extraVideoQuality > 0);
        }
        mMediaRecorder.setVideoFrameRate(15);
        if (videoQualityHigh) {
            mMediaRecorder.setVideoSize(320,240);
        } else {
            mMediaRecorder.setVideoSize(176,144);
        }
        mMediaRecorder.setVideoEncoder
(MediaRecorder.VideoEncoder.MPEG_4_SP);
        if (!DEBUG_SUPPRESS_AUDIO_RECORDING) {
            mMediaRecorder.setAudioEncoder
(MediaRecorder.AudioEncoder.AMR_NB);
        }
        mMediaRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());

        long remaining = getAvailableStorage();

        try {
            mMediaRecorder.setMaxFileSize(remaining -
LOW_STORAGE_THRESHOLD / 4);
        } catch (RuntimeException exception) {

        }

        try {
            mMediaRecorder.prepare();
        } catch (IOException exception) {
            Log.e(TAG, "prepare failed for " + mCameraVideoFilename);
            releaseMediaRecorder();
            return false;
        }
        mMediaRecorderRecording = false;

        if (!mIsVideoCaptureIntent && !mThumbController.isUriValid())
{
            updateLastVideo();
        }

        if (!mIsVideoCaptureIntent) {
            mThumbController.updateDisplayIfNeeded();
        }

        return true;







and the following is the logcat shows:

I/ActivityManager(   85): Starting activity: Intent
{ action=android.intent.action.MAIN categories=
{android.intent.category.LAUNCHER} flags=0x10200000 comp=
{com.android.camera/com.android.camera.VideoCamera} }
I/ActivityManager(   85): Start proc com.android.camera for activity
com.android.camera/.VideoCamera: pid=279 uid=10000 gids={1006, 2001,
3003}
D/dalvikvm(   85): GC freed 7528 objects / 374056 bytes in 680ms
I/WindowManager(   85): Setting rotation to 1, animFlags=0
I/WindowManager(   85): Config changed: { scale=1.0 imsi=0/0
locale=en_US touch=3 key=2/1/2 nav=3 orien=2 }
I/ARMAssembler(   85): generated
scanline__00000077:03010104_00000004_00000000 [ 22 ipp] (41 ins) at
[0x21eb98:0x21ec3c] in 427246 ns
W/WindowManager(   85): performLayoutAndPlaceSurfacesLocked called
while in layout
W/WindowManager(   85): performLayoutAndPlaceSurfacesLocked called
while in layout
I/ARMAssembler(   85): generated
scanline__00000077:03545404_00000004_00000000 [ 47 ipp] (67 ins) at
[0x18c230:0x18c33c] in 610351 ns
D/StatusBar(   85): updateResources
D/LocationManager(  279): Constructor: service =
android.location.ilocationmanager$stub$pr...@4360c228
V/ImageManager(  279): storage state is mounted
V/ImageManager(  279): storage writable is true
V/videocamera(  279): initializeVideo
V/videocamera(  279): Releasing media recorder.
V/videocamera(  279): SurfaceHolder is null
I/VideoPreview(  279):  setting size: 320x240
I/VideoPreview(  279): ar 1.3333334 setting size: 320x240
V/videocamera(  279): stopVideoRecording
V/videocamera(  279): initializeVideo
V/videocamera(  279): Releasing media recorder.
V/MediaRecorder(  279): constructor
V/PVMediaRecorder(   55): constructor
V/AuthorDriver(   55): InitializeForThread
V/AuthorDriver(   55): OMX_Init
V/AuthorDriver(   55): Create author ...
V/MediaRecorder(  279): doCleanUp
V/MediaRecorder(  279): setListener
V/videocamera(  279): DEBUG_SUPPRESS_AUDIO_RECORDING is true.
V/MediaRecorder(  279): setVideoSource(1)
V/MediaRecorder(  279): Call init() since the media recorder is not
initialized yet
V/MediaRecorder(  279): init
V/PVMediaRecorder(   55): init
V/AuthorDriver(   55): Command (1) completed with status(1)
V/PVMediaRecorder(   55): setListener
V/PVMediaRecorder(   55): setVideoSource(1)
V/AuthorDriver(   55): create mio input video
V/AuthorDriver(   55): Command (3) completed with status(1)
V/MediaRecorder(  279): setOutputFormat(1)
V/PVMediaRecorder(   55): setOutputFormat(1)
V/AuthorDriver(   55): Command (5) completed with status(1)
V/MediaRecorder(  279): setParameters(max-duration=600000)
V/PVMediaRecorder(   55): setParameters(max-duration=600000)
E/PVAE    (   55): PVAuthorEngine::NodeUtilCommandCompleted: Exit
V/videocamera(  279): Current camera video filename: /sdcard/DCIM/
Camera/video-2000-01-01-02-39-17.3gp
V/MediaRecorder(  279): setVideoFrameRate(15)
V/PVMediaRecorder(   55): setVideoFrameRate(15)
V/MediaRecorder(  279): setVideoSize(320, 240)
V/PVMediaRecorder(   55): setVideoSize(320, 240)
V/MediaRecorder(  279): setVideoEncoder(1)
V/PVMediaRecorder(   55): setVideoEncoder(1)
V/AuthorDriver(   55): Command (6) completed with status(1)
V/ImageManager(  279): storage state is mounted
V/ImageManager(  279): storage writable is true
V/MediaRecorder(  279): setParameters(max-filesize=3882352640)
V/PVMediaRecorder(   55): setParameters(max-filesize=3882352640)
V/MediaRecorder(  279): setOutputFile(30, 0, 0)
V/PVMediaRecorder(   55): setOutputFile(10, 0, 0)
I/MediaRecorderJNI(  279): prepare: surface=0x1bb140 (id=1)
V/MediaRecorder(  279): setPreviewSurface(0x1bb140)
V/PVMediaRecorder(   55): setPreviewSurface(0xa8f8)
V/MediaRecorder(  279): prepare
V/PVMediaRecorder(   55): prepare
D/AuthorDriver(   55): handle Prepare: 13, comp: -1486358616, cookie:
80064
E/PVAE    (   55): PVAuthorEngine::Init: aContextData=0x1a600
E/PVAE    (   55): PVAuthorEngine::Run: Enter
E/PVAE    (   55): PVAuthorEngine::DoInit
E/PVAE    (   55): PVAuthorEngineNodeUtility::Prepare:
&aNodes=0x18f40, aContext=0x0
E/PVAE    (   55): PVAuthorEngineNodeUtility::AddCmdToQueue:
aCmd.iType=6
E/PVAE    (   55): PVAuthorEngineNodeUtility::Prepare:
&aNodes=0x18f1c, aContext=0x0
E/PVAE    (   55): PVAuthorEngineNodeUtility::AddCmdToQueue:
aCmd.iType=6
E/PVAE    (   55): PVAuthorEngineNodeUtility::Prepare:
&aNodes=0x18ef8, aContext=0x0
E/PVAE    (   55): PVAuthorEngineNodeUtility::AddCmdToQueue:
aCmd.iType=6
E/PVAE    (   55): PVAuthorEngine::Run: Exit
E/PVAE    (   55): PVAuthorEngineNodeUtility::Run: Enter
E/PVAE    (   55): PVAuthorEngineNodeUtility::Run: cmd.iType=6
E/PVAE    (   55): PVAuthorEngineNodeUtility::DoPrepare
E/PVAE    (   55): PVAuthorEngineNodeUtility::Doprepare: aCmd.iNodes
[i] = 0
E/PVAE    (   55): PVAuthorEngineNodeUtility::Run: Exit
E/PVAE    (   55): PVAuthorEngineNodeUtility::NodeCommandCompleted
E/PVAE    (   55): PVAuthorEngineNodeUtility::CompleteStateTransition
E/PVAE    (   55): PVAuthorEngineNodeUtility::CompleteStateTransition:
node 0 (2) does not have the same state as the node util(3)
E/PVAE    (   55): PVAuthorEngineNodeUtility::CompleteStateTransition:
Continue to wait
E/PVAE    (   55): PVAuthorEngineNodeUtility::NodeCommandCompleted
E/PVAE    (   55): PVAuthorEngineNodeUtility::CompleteStateTransition
E/PVAE    (   55): PVAuthorEngineNodeUtility::CompleteStateTransition:
node 0 (2) does not have the same state as the node util(3)
E/PVAE    (   55): PVAuthorEngineNodeUtility::CompleteStateTransition:
Continue to wait
E/PVAE    (   55): PVAuthorEngineNodeUtility::NodeCommandCompleted
E/PVAE    (   55): PVAuthorEngineNodeUtility::CompleteStateTransition
E/PVAE    (   55): PVAuthorEngineNodeUtility::CompleteStateTransition:
node 0 (2) does not have the same state as the node util(3)
E/PVAE    (   55): PVAuthorEngineNodeUtility::CompleteStateTransition:
Continue to wait
E/PVAE    (   55): PVAuthorEngine::HandleNodeInformationalEvent
E/PVAE    (   55): PVAuthorEngine::HandleNodeInformationalEvent sends
unknown eventType:24
E/PVAE    (   55): PVAuthorEngineNodeUtility::NodeCommandCompleted
E/PVAE    (   55): PVAuthorEngineNodeUtility::CompleteStateTransition
E/PVAE    (   55): PVAuthorEngineNodeUtility::CompleteStateTransition:
return PVMFSuccess
E/PVAE    (   55): PVAuthorEngineNodeUtility::CompleteUtilityCmd:
aCmd.iType=6,  aStatus=0x1
E/PVAE    (   55): PVAuthorEngine::NodeUtilCommandCompleted
E/PVAE    (   55): PVAuthorEngine::NodeUtilCommandCompleted cmdType:12
E/PVAE    (   55): PVAuthorEngineNodeUtility::GetCommandQueueSize:
size=2
E/PVAE    (   55): PVAuthorEngine::NodeUtilCommandCompleted: Exit
E/PVAE    (   55): PVAuthorEngineNodeUtility::Run: Enter
E/PVAE    (   55): PVAuthorEngineNodeUtility::Run: cmd.iType=6
E/PVAE    (   55): PVAuthorEngineNodeUtility::DoPrepare
E/PVAE    (   55): PVAuthorEngineNodeUtility::Doprepare: aCmd.iNodes
[i] = 0
E/PVAE    (   55): PVAuthorEngineNodeUtility::Run: Exit
E/PVAE    (   55): PVAuthorEngineNodeUtility::NodeCommandCompleted
E/PVAE    (   55): PVAuthorEngineNodeUtility::NodeCommandCompleted:
Command failed - context=0x0, status=0xffffffef
E/PVAE    (   55): PVAuthorEngineNodeUtility::CompleteUtilityCmd:
aCmd.iType=6,  aStatus=0xffffffef
E/PVAE    (   55): PVAuthorEngine::NodeUtilCommandCompleted
E/PVAE    (   55): PVAuthorEngine::NodeUtilCommandCompleted cmdType:12
E/PVAE    (   55): PVAuthorEngine::SetPVAEState: aState=5
E/PVAE    (   55): PVAuthorEngineNodeUtility::GetCommandQueueSize:
size=1
E/PVAE    (   55): PVAuthorEngineNodeUtility::Run: Enter
E/PVAE    (   55): PVAuthorEngineNodeUtility::Run: cmd.iType=6
E/PVAE    (   55): PVAuthorEngineNodeUtility::DoPrepare
E/PVAE    (   55): PVAuthorEngineNodeUtility::Doprepare: aCmd.iNodes
[i] = 0
E/PVAE    (   55): PVAuthorEngineNodeUtility::Run: Exit
D/CameraService(   55): Connect E from ICameraClient 0x1bf14
D/CameraService(   55): Client E constructor
D/CameraHardware(   55): createInstance
D/CameraHardware(   55): CameraHardware
D/CameraHardware(   55): ceInit
E/MediaPlayer(   55): Unable to to create media player
E/CameraService(   55): Failed to load CameraService sounds.
E/MediaPlayer(   55): Unable to to create media player
E/CameraService(   55): Failed to load CameraService sounds.
D/CameraService(   55): Client X constructor
D/CameraService(   55): Connect X
D/CameraService(   55): setPreviewDisplay(0xa8f8)
D/CameraInput(   55): Intended mFrameWidth=320, mFrameHeight=240
D/CameraService(   55): getParameters
D/CameraHardware(   55): getParameters
D/CameraService(   55): setParameters(picture-format=yuv422sp;picture-
size=1280x1024;preview-format=yuv422sp;preview-frame-rate=15;preview-
size=320x240)
D/CameraHardware(   55): setParameters
D/CameraService(   55): getParameters
D/CameraHardware(   55): getParameters
D/CameraInput(   55): Actual mFrameWidth=320, mFrameHeight=240
D/CameraService(   55): startCameraMode(0)
V/CameraService(   55): startPreviewMode
D/CameraHardware(   55): getParameters
D/CameraHardware(   55): startPreview
D/CameraHardware(   55): ceSetParameters
D/CameraHardware(   55): CAM_PREVIEW
D/CameraHardware(   55): ceSetPreviewParameters
D/CameraHardware(   55): VIDIOC_S_FMT 320  240
D/CameraHardware(   55): VIDIOC_S_FMT sizeof(v4l2_format) 204
D/CameraHardware(   55): initHeapLocked: preview size=320x240
D/CameraHardware(   55): init_mmap enter!
D/CameraHardware(   55): buffers[0].start  = 0x4091a000
D/CameraHardware(   55): buffers[0].length  = 155648
D/CameraHardware(   55): buffers[1].start  = 0x40940000
D/CameraHardware(   55): buffers[1].length  = 155648
D/CameraHardware(   55): buffers[2].start  = 0x40966000
D/CameraHardware(   55): buffers[2].length  = 155648
D/CameraHardware(   55): buffers[3].start  = 0x4098c000
D/CameraHardware(   55): buffers[3].length  = 155648
D/CameraHardware(   55): init_mmap exit!
D/CameraHardware(   55): initHeapLocked   mCEHandle 000=:8
D/CameraHardware(   55): initHeapLocked   mCEHandle111  =:8
D/CameraHardware(   55): initHeapLocked   mCEHandle222  =:8
mPreviewHeap->base:0x409b2000
D/CameraHardware(   55): ceStartPreview
D/CameraHardware(   55): CAM_AUTOCAM_PREVIEW
D/CameraHardware(   55): vendor/marvell/marvell_310/libcamera/
CameraHardware.cpp startPreview 679
D/CameraHardware(   55): vendor/marvell/marvell_310/libcamera/
CameraHardware.cpp startPreview 681
D/CameraHardware(   55): getPreviewHeap
E/PVAE    (   55): PVAuthorEngine::HandleNodeInformationalEvent
E/PVAE    (   55): PVAuthorEngine::HandleNodeInformationalEvent sends
unknown eventType:24
E/PVAE    (   55): PVAuthorEngineNodeUtility::NodeCommandCompleted
E/PVAE    (   55): PVAuthorEngineNodeUtility::CompleteStateTransition
E/PVAE    (   55): PVAuthorEngineNodeUtility::CompleteStateTransition:
return PVMFSuccess
E/PVAE    (   55): PVAuthorEngineNodeUtility::CompleteUtilityCmd:
aCmd.iType=6,  aStatus=0x1
E/PVAE    (   55): PVAuthorEngine::NodeUtilCommandCompleted
E/PVAE    (   55): PVAuthorEngine::NodeUtilCommandCompleted cmdType:12
E/PVAE    (   55): PVAuthorEngineNodeUtility::GetCommandQueueSize:
size=0
E/PVAE    (   55): PVAuthorEngine::Comple{*filter*}gineCommand:
aStatus=0xffffffff, aResponseData=0x0, aResponseDataSize=0
V/AuthorDriver(   55): Command (13) completed with status(-1)
E/MediaRecorder(  279): prepare failed: 80000000
E/videocamera(  279): prepare failed for /sdcard/DCIM/Camera/
video-2000-01-01-02-39-17.3gp
V/videocamera(  279): Releasing media recorder.
V/videocamera(  279): Empty video file deleted: /sdcard/DCIM/Camera/
video-2000-01-01-02-39-17.3gp
V/MediaRecorder(  279): reset
V/MediaRecorder(  279): doCleanUp

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

3. animated gif in webview

4. how to activite my acivity

5. Android SDK memory coruption

6. Why is my animation leaving a trail?

7. Detecting when the file system runs out of space