Search in sources :

Example 1 with IllegalStateException

use of java.lang.IllegalStateException in project android_frameworks_base by ParanoidAndroid.

the class AudioRecord method stop.

/**
     * Stops recording.
     * @throws IllegalStateException
     */
public void stop() throws IllegalStateException {
    if (mState != STATE_INITIALIZED) {
        throw (new IllegalStateException("stop() called on an uninitialized AudioRecord."));
    }
    // stop recording
    synchronized (mRecordingStateLock) {
        native_stop();
        mRecordingState = RECORDSTATE_STOPPED;
    }
}
Also used : IllegalStateException(java.lang.IllegalStateException)

Example 2 with IllegalStateException

use of java.lang.IllegalStateException in project XobotOS by xamarin.

the class AudioRecord method stop.

/**
     * Stops recording.
     * @throws IllegalStateException
     */
public void stop() throws IllegalStateException {
    if (mState != STATE_INITIALIZED) {
        throw (new IllegalStateException("stop() called on an uninitialized AudioRecord."));
    }
    // stop recording
    synchronized (mRecordingStateLock) {
        native_stop();
        mRecordingState = RECORDSTATE_STOPPED;
    }
}
Also used : IllegalStateException(java.lang.IllegalStateException)

Example 3 with IllegalStateException

use of java.lang.IllegalStateException in project cornerstone by Onskreen.

the class ActivityManagerService method dumpHeap.

public boolean dumpHeap(String process, boolean managed, String path, ParcelFileDescriptor fd) throws RemoteException {
    try {
        synchronized (this) {
            // its own permission (same as profileControl).
            if (checkCallingPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER) != PackageManager.PERMISSION_GRANTED) {
                throw new SecurityException("Requires permission " + android.Manifest.permission.SET_ACTIVITY_WATCHER);
            }
            if (fd == null) {
                throw new IllegalArgumentException("null fd");
            }
            ProcessRecord proc = null;
            try {
                int pid = Integer.parseInt(process);
                synchronized (mPidsSelfLocked) {
                    proc = mPidsSelfLocked.get(pid);
                }
            } catch (NumberFormatException e) {
            }
            if (proc == null) {
                HashMap<String, SparseArray<ProcessRecord>> all = mProcessNames.getMap();
                SparseArray<ProcessRecord> procs = all.get(process);
                if (procs != null && procs.size() > 0) {
                    proc = procs.valueAt(0);
                }
            }
            if (proc == null || proc.thread == null) {
                throw new IllegalArgumentException("Unknown process: " + process);
            }
            boolean isDebuggable = "1".equals(SystemProperties.get(SYSTEM_DEBUGGABLE, "0"));
            if (!isDebuggable) {
                if ((proc.info.flags & ApplicationInfo.FLAG_DEBUGGABLE) == 0) {
                    throw new SecurityException("Process not debuggable: " + proc);
                }
            }
            proc.thread.dumpHeap(managed, path, fd);
            fd = null;
            return true;
        }
    } catch (RemoteException e) {
        throw new IllegalStateException("Process disappeared");
    } finally {
        if (fd != null) {
            try {
                fd.close();
            } catch (IOException e) {
            }
        }
    }
}
Also used : IllegalStateException(java.lang.IllegalStateException) IOException(java.io.IOException) SparseArray(android.util.SparseArray) RemoteException(android.os.RemoteException)

Example 4 with IllegalStateException

use of java.lang.IllegalStateException in project cornerstone by Onskreen.

the class ActivityManagerService method profileControl.

public boolean profileControl(String process, boolean start, String path, ParcelFileDescriptor fd, int profileType) throws RemoteException {
    try {
        synchronized (this) {
            // its own permission.
            if (checkCallingPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER) != PackageManager.PERMISSION_GRANTED) {
                throw new SecurityException("Requires permission " + android.Manifest.permission.SET_ACTIVITY_WATCHER);
            }
            if (start && fd == null) {
                throw new IllegalArgumentException("null fd");
            }
            ProcessRecord proc = null;
            if (process != null) {
                try {
                    int pid = Integer.parseInt(process);
                    synchronized (mPidsSelfLocked) {
                        proc = mPidsSelfLocked.get(pid);
                    }
                } catch (NumberFormatException e) {
                }
                if (proc == null) {
                    HashMap<String, SparseArray<ProcessRecord>> all = mProcessNames.getMap();
                    SparseArray<ProcessRecord> procs = all.get(process);
                    if (procs != null && procs.size() > 0) {
                        proc = procs.valueAt(0);
                    }
                }
            }
            if (start && (proc == null || proc.thread == null)) {
                throw new IllegalArgumentException("Unknown process: " + process);
            }
            if (start) {
                stopProfilerLocked(null, null, 0);
                setProfileApp(proc.info, proc.processName, path, fd, false);
                mProfileProc = proc;
                mProfileType = profileType;
                try {
                    fd = fd.dup();
                } catch (IOException e) {
                    fd = null;
                }
                proc.thread.profilerControl(start, path, fd, profileType);
                fd = null;
                mProfileFd = null;
            } else {
                stopProfilerLocked(proc, path, profileType);
                if (fd != null) {
                    try {
                        fd.close();
                    } catch (IOException e) {
                    }
                }
            }
            return true;
        }
    } catch (RemoteException e) {
        throw new IllegalStateException("Process disappeared");
    } finally {
        if (fd != null) {
            try {
                fd.close();
            } catch (IOException e) {
            }
        }
    }
}
Also used : IllegalStateException(java.lang.IllegalStateException) SparseArray(android.util.SparseArray) IOException(java.io.IOException) RemoteException(android.os.RemoteException)

Example 5 with IllegalStateException

use of java.lang.IllegalStateException in project cornerstone by Onskreen.

the class ActivityManagerService method stopProfilerLocked.

private void stopProfilerLocked(ProcessRecord proc, String path, int profileType) {
    if (proc == null || proc == mProfileProc) {
        proc = mProfileProc;
        path = mProfileFile;
        profileType = mProfileType;
        clearProfilerLocked();
    }
    if (proc == null) {
        return;
    }
    try {
        proc.thread.profilerControl(false, path, null, profileType);
    } catch (RemoteException e) {
        throw new IllegalStateException("Process disappeared");
    }
}
Also used : IllegalStateException(java.lang.IllegalStateException) RemoteException(android.os.RemoteException)

Aggregations

IllegalStateException (java.lang.IllegalStateException)11 RemoteException (android.os.RemoteException)3 SparseArray (android.util.SparseArray)2 IOException (java.io.IOException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Field (java.lang.reflect.Field)1 Method (java.lang.reflect.Method)1 JmsMessageProducer (org.apache.storm.jms.JmsMessageProducer)1