diff options
author | Svetoslav <svetoslavganov@google.com> | 2015-05-03 00:41:49 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-03 00:41:50 +0000 |
commit | e9fc4cda50664558028b79edd1f4b893cd4f52d3 (patch) | |
tree | be8bde30269f2b7771d8ce479eaa52a660ce9441 /media | |
parent | 5ba44affe6747d2995030005bd99471d621d6e79 (diff) | |
parent | fbf0ecabac5d7a929628b43ffe8f4f953e47bd54 (diff) | |
download | frameworks_base-e9fc4cda50664558028b79edd1f4b893cd4f52d3.zip frameworks_base-e9fc4cda50664558028b79edd1f4b893cd4f52d3.tar.gz frameworks_base-e9fc4cda50664558028b79edd1f4b893cd4f52d3.tar.bz2 |
Merge "Add camera app op - framework" into mnc-dev
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/AudioRecord.java | 14 | ||||
-rw-r--r-- | media/java/android/media/MediaRecorder.java | 15 | ||||
-rw-r--r-- | media/java/android/media/audiofx/AudioEffect.java | 14 | ||||
-rw-r--r-- | media/java/android/media/audiofx/Visualizer.java | 14 |
4 files changed, 5 insertions, 52 deletions
diff --git a/media/java/android/media/AudioRecord.java b/media/java/android/media/AudioRecord.java index d5e6b3e..472da02 100644 --- a/media/java/android/media/AudioRecord.java +++ b/media/java/android/media/AudioRecord.java @@ -27,7 +27,6 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.SystemApi; import android.app.ActivityThread; -import android.app.Application; import android.os.Binder; import android.os.Handler; import android.os.IBinder; @@ -380,7 +379,7 @@ public class AudioRecord int initResult = native_setup( new WeakReference<AudioRecord>(this), mAudioAttributes, mSampleRate, mChannelMask, mChannelIndexMask, mAudioFormat, mNativeBufferSizeInBytes, - session, getMyOpPackageName()); + session, ActivityThread.currentOpPackageName()); if (initResult != SUCCESS) { loge("Error code "+initResult+" when initializing native AudioRecord object."); return; // with mState == STATE_UNINITIALIZED @@ -1500,15 +1499,4 @@ public class AudioRecord private static void loge(String msg) { Log.e(TAG, msg); } - - private static String getMyOpPackageName() { - ActivityThread activityThread = ActivityThread.currentActivityThread(); - if (activityThread != null) { - Application application = activityThread.getApplication(); - if (application != null) { - return application.getOpPackageName(); - } - } - throw new IllegalStateException("Cannot create AudioRecord outside of an app"); - } } diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java index a2f596b..206c171 100644 --- a/media/java/android/media/MediaRecorder.java +++ b/media/java/android/media/MediaRecorder.java @@ -19,7 +19,6 @@ package android.media; import android.annotation.NonNull; import android.annotation.SystemApi; import android.app.ActivityThread; -import android.app.Application; import android.hardware.Camera; import android.os.Handler; import android.os.Looper; @@ -113,7 +112,8 @@ public class MediaRecorder /* Native setup requires a weak reference to our object. * It's easier to create it here than in C++. */ - native_setup(new WeakReference<MediaRecorder>(this), packageName, getMyOpPackageName()); + native_setup(new WeakReference<MediaRecorder>(this), packageName, + ActivityThread.currentOpPackageName()); } /** @@ -1096,15 +1096,4 @@ public class MediaRecorder @Override protected void finalize() { native_finalize(); } - - private static String getMyOpPackageName() { - ActivityThread activityThread = ActivityThread.currentActivityThread(); - if (activityThread != null) { - Application application = activityThread.getApplication(); - if (application != null) { - return application.getOpPackageName(); - } - } - throw new IllegalStateException("Cannot create AudioRecord outside of an app"); - } } diff --git a/media/java/android/media/audiofx/AudioEffect.java b/media/java/android/media/audiofx/AudioEffect.java index 9fc90df..b94a7e6 100644 --- a/media/java/android/media/audiofx/AudioEffect.java +++ b/media/java/android/media/audiofx/AudioEffect.java @@ -19,7 +19,6 @@ package android.media.audiofx; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.app.ActivityThread; -import android.app.Application; import android.os.Handler; import android.os.Looper; import android.os.Message; @@ -397,7 +396,7 @@ public class AudioEffect { // native initialization int initResult = native_setup(new WeakReference<AudioEffect>(this), type.toString(), uuid.toString(), priority, audioSession, id, - desc, getMyOpPackageName()); + desc, ActivityThread.currentOpPackageName()); if (initResult != SUCCESS && initResult != ALREADY_EXISTS) { Log.e(TAG, "Error code " + initResult + " when initializing AudioEffect."); @@ -1359,15 +1358,4 @@ public class AudioEffect { } return b; } - - private static String getMyOpPackageName() { - ActivityThread activityThread = ActivityThread.currentActivityThread(); - if (activityThread != null) { - Application application = activityThread.getApplication(); - if (application != null) { - return application.getOpPackageName(); - } - } - throw new IllegalStateException("Cannot create AudioEffect outside of an app"); - } } diff --git a/media/java/android/media/audiofx/Visualizer.java b/media/java/android/media/audiofx/Visualizer.java index 0c48063..0fe7246 100644 --- a/media/java/android/media/audiofx/Visualizer.java +++ b/media/java/android/media/audiofx/Visualizer.java @@ -17,7 +17,6 @@ package android.media.audiofx; import android.app.ActivityThread; -import android.app.Application; import android.util.Log; import java.lang.ref.WeakReference; import android.os.Handler; @@ -209,7 +208,7 @@ public class Visualizer { mState = STATE_UNINITIALIZED; // native initialization int result = native_setup(new WeakReference<Visualizer>(this), audioSession, id, - getMyOpPackageName()); + ActivityThread.currentOpPackageName()); if (result != SUCCESS && result != ALREADY_EXISTS) { Log.e(TAG, "Error code "+result+" when initializing Visualizer."); switch (result) { @@ -769,16 +768,5 @@ public class Visualizer { } } - - private static String getMyOpPackageName() { - ActivityThread activityThread = ActivityThread.currentActivityThread(); - if (activityThread != null) { - Application application = activityThread.getApplication(); - if (application != null) { - return application.getOpPackageName(); - } - } - throw new IllegalStateException("Cannot create AudioRecord outside of an app"); - } } |