diff options
| author | Likai Ding <likaid@codeaurora.org> | 2016-05-20 14:21:43 +0800 |
|---|---|---|
| committer | Likai Ding <likaid@codeaurora.org> | 2016-06-03 15:39:39 +0800 |
| commit | 4dc5e6d88c57ca9ab34169572fbef104293bbe82 (patch) | |
| tree | 745ac090d61d85a7a91df8cff111e49860a9dd9f | |
| parent | fdb52c1657054bc3ae54c6006a8fd2807a6d7137 (diff) | |
| download | android_packages_apps_Gallery2-4dc5e6d88c57ca9ab34169572fbef104293bbe82.tar.gz android_packages_apps_Gallery2-4dc5e6d88c57ca9ab34169572fbef104293bbe82.tar.bz2 android_packages_apps_Gallery2-4dc5e6d88c57ca9ab34169572fbef104293bbe82.zip | |
Gallery: remove calls to @hide and internal API/members
CRs-Fixed: 986672
Change-Id: Ib7b9eb494da9c38191f75960f01e62dfbf356205
10 files changed, 41 insertions, 48 deletions
diff --git a/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java b/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java index 2802d075c..06bace867 100644 --- a/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java +++ b/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java @@ -194,6 +194,9 @@ public class ApiHelper { public static final boolean HAS_DISPLAY_LISTENER = Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1; + // from android.provider.Settings.Global + public static final String MULTI_SIM_DATA_CALL_SUBSCRIPTION = "multi_sim_data_call"; + public static int getIntFieldIfExists(Class<?> klass, String fieldName, Class<?> obj, int defaultVal) { try { diff --git a/src/com/android/gallery3d/app/GestureController.java b/src/com/android/gallery3d/app/GestureController.java index 51ca04d3d..22deb6706 100644 --- a/src/com/android/gallery3d/app/GestureController.java +++ b/src/com/android/gallery3d/app/GestureController.java @@ -159,7 +159,7 @@ public class GestureController { // decide which process is needed. switch (event.getAction()) { case MotionEvent.ACTION_DOWN: - mStartEvent = event.copy(); + mStartEvent = MotionEvent.obtain(event); break; case MotionEvent.ACTION_MOVE: if (mType == Type.NONE && mStartEvent != null) { diff --git a/src/com/android/gallery3d/app/GestureControllerOverlay.java b/src/com/android/gallery3d/app/GestureControllerOverlay.java index 6ac278608..38b7f0d65 100644 --- a/src/com/android/gallery3d/app/GestureControllerOverlay.java +++ b/src/com/android/gallery3d/app/GestureControllerOverlay.java @@ -223,7 +223,7 @@ public class GestureControllerOverlay extends FrameLayout implements adjustPercent = 1.0f; } - WindowManager.LayoutParams lp = ((MovieActivity) mContext).getWindow().getAttributes(); + WindowManager.LayoutParams lp = ((MovieActivity) getContext()).getWindow().getAttributes(); if (mStartBrightness < 0) { mStartBrightness = lp.screenBrightness; } @@ -234,7 +234,7 @@ public class GestureControllerOverlay extends FrameLayout implements targetBrightness = 1.0f; } lp.screenBrightness = targetBrightness; - ((MovieActivity) mContext).getWindow().setAttributes(lp); + ((MovieActivity) getContext()).getWindow().setAttributes(lp); if (mCurrentIndicator != null) { mCurrentIndicator.setCompoundDrawables(null, mBrightnessDrawable, null, null); @@ -251,7 +251,7 @@ public class GestureControllerOverlay extends FrameLayout implements adjustPercent = 1.0f; } - AudioManager audioManager = (AudioManager) mContext + AudioManager audioManager = (AudioManager) getContext() .getSystemService(Context.AUDIO_SERVICE); final int STREAM = AudioManager.STREAM_MUSIC; int maxVolume = audioManager.getStreamMaxVolume(STREAM); diff --git a/src/com/android/gallery3d/app/MovieControllerOverlay.java b/src/com/android/gallery3d/app/MovieControllerOverlay.java index e1a3d0282..80a7fc6aa 100644 --- a/src/com/android/gallery3d/app/MovieControllerOverlay.java +++ b/src/com/android/gallery3d/app/MovieControllerOverlay.java @@ -17,11 +17,9 @@ package com.android.gallery3d.app; import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; import android.graphics.Color; import android.graphics.Rect; -import android.graphics.drawable.VectorDrawable; +import android.graphics.drawable.Drawable; import android.media.MediaPlayer; import android.os.Handler; import android.text.TextUtils; @@ -691,9 +689,11 @@ public class MovieControllerOverlay extends CommonControllerOverlay implements } // for screen layout - VectorDrawable screenButton = VectorDrawable.create(context.getResources(), - R.drawable.ic_media_bigscreen); - mScreenWidth = screenButton.getIntrinsicWidth(); + Drawable screenButton = context.getResources() + .getDrawable(R.drawable.ic_media_bigscreen, null); + if (screenButton != null) { + mScreenWidth = screenButton.getIntrinsicWidth(); + } mScreenPadding = (int) (metrics.density * MARGIN); } @@ -780,9 +780,12 @@ public class MovieControllerOverlay extends CommonControllerOverlay implements void init(Context context) { Log.v(TAG, "ControllerRewindAndForwardExt init"); mTimeBarHeight = mTimeBar.getPreferredHeight(); - VectorDrawable drawable = - VectorDrawable.create(context.getResources(), R.drawable.ic_menu_forward); - mButtonWidth = drawable.getIntrinsicWidth(); + + Drawable forwardMenu = context.getResources(). + getDrawable(R.drawable.ic_menu_forward, null); + if (forwardMenu != null) { + mButtonWidth = forwardMenu.getIntrinsicWidth(); + } mContollerButtons = new LinearLayout(context); LinearLayout.LayoutParams wrapContent = new LinearLayout.LayoutParams( diff --git a/src/com/android/gallery3d/app/MoviePlayer.java b/src/com/android/gallery3d/app/MoviePlayer.java index 520b462ee..f0d6a1ce7 100644 --- a/src/com/android/gallery3d/app/MoviePlayer.java +++ b/src/com/android/gallery3d/app/MoviePlayer.java @@ -645,7 +645,7 @@ public class MoviePlayer implements Log.v(TAG, "playVideo()"); } - if (GalleryUtils.isTelephonyCallInProgress()) { + if (GalleryUtils.isTelephonyCallInProgress(mContext)) { Log.w(TAG, "CS/CSVT Call is in progress, can't play video"); return false; } diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index 50f813276..624c0a80e 100644 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -26,7 +26,6 @@ import android.content.pm.PackageManager; import android.content.res.Configuration; //import android.drm.DrmHelper; import android.graphics.Rect; -import android.media.MediaFile; import android.net.Uri; import android.nfc.NfcAdapter; import android.nfc.NfcAdapter.CreateBeamUrisCallback; @@ -1204,7 +1203,7 @@ public abstract class PhotoPage extends ActivityState implements Intent intent = new Intent(mActivity, TrimVideo.class); intent.setData(manager.getContentUri(path)); // We need the file path to wrap this into a RandomAccessFile. - String str = android.media.MediaFile.getMimeTypeForFile(current.getFilePath()); + String str = current.getMimeType(); if("video/mp4".equals(str) || "video/mpeg4".equals(str) || "video/3gpp".equals(str) || "video/3gpp2".equals(str)) { intent.putExtra(KEY_MEDIA_ITEM_PATH, current.getFilePath()); @@ -1388,7 +1387,7 @@ public abstract class PhotoPage extends ActivityState implements } public void playVideo(Activity activity, Uri uri, String title) { - if (GalleryUtils.isTelephonyCallInProgress()) { + if (GalleryUtils.isTelephonyCallInProgress(mActivity)) { Log.w(TAG, "CS/CSVT Call is in progress, can't play video"); return; } diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java index c1395170b..21962424a 100644 --- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java +++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java @@ -526,7 +526,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL public void setActionBar() { ActionBar actionBar = getActionBar(); - actionBar.setShowHideAnimationEnabled(false); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setBackgroundDrawable(new ColorDrawable(getResources() .getColor(R.color.edit_actionbar_background))); diff --git a/src/com/android/gallery3d/util/GalleryUtils.java b/src/com/android/gallery3d/util/GalleryUtils.java index 6a511273a..a0580016b 100644 --- a/src/com/android/gallery3d/util/GalleryUtils.java +++ b/src/com/android/gallery3d/util/GalleryUtils.java @@ -34,7 +34,6 @@ import android.os.Environment; import android.os.StatFs; import android.preference.PreferenceManager; import android.provider.MediaStore; -import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.util.DisplayMetrics; import android.util.Log; @@ -48,7 +47,6 @@ import com.android.gallery3d.common.ApiHelper; import com.android.gallery3d.data.DataManager; import com.android.gallery3d.data.MediaItem; import com.android.gallery3d.ui.TiledScreenNail; -import com.android.gallery3d.util.IntentHelper; import com.android.gallery3d.util.ThreadPool.CancelListener; import com.android.gallery3d.util.ThreadPool.JobContext; @@ -439,21 +437,9 @@ public class GalleryUtils { ed.commit(); } - public static boolean isTelephonyCallInProgress() { - TelephonyManager telephonyManager = TelephonyManager.getDefault(); - - int count = telephonyManager.getPhoneCount(); - for (int i = 0; i < count; i++) { - int[] subId = SubscriptionManager.getSubId(i); - if (subId != null && subId.length > 0) { - int telephony_state = telephonyManager.getCallState(subId[0]); - - if (telephony_state == TelephonyManager.CALL_STATE_OFFHOOK - || telephony_state == TelephonyManager.CALL_STATE_RINGING) { - return true; - } - } - } - return false; + public static boolean isTelephonyCallInProgress(Context context) { + TelephonyManager telephonyManager = + (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); + return telephonyManager.getCallState() != TelephonyManager.CALL_STATE_IDLE; } } diff --git a/src/org/codeaurora/gallery3d/video/CodeauroraVideoView.java b/src/org/codeaurora/gallery3d/video/CodeauroraVideoView.java index ace5cec64..892c6d6b9 100644 --- a/src/org/codeaurora/gallery3d/video/CodeauroraVideoView.java +++ b/src/org/codeaurora/gallery3d/video/CodeauroraVideoView.java @@ -284,17 +284,17 @@ public class CodeauroraVideoView extends SurfaceView implements MediaPlayerContr * longer have a window, don't bother showing the user an error. */ if (getWindowToken() != null && mErrorDialogShowing == false) { - final Resources r = mContext.getResources(); + final Resources r = getContext().getResources(); int messageId; if (frameworkErr == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) { - messageId = com.android.internal.R.string.VideoView_error_text_invalid_progressive_playback; + messageId = android.R.string.VideoView_error_text_invalid_progressive_playback; } else { - messageId = com.android.internal.R.string.VideoView_error_text_unknown; + messageId = android.R.string.VideoView_error_text_unknown; } - new AlertDialog.Builder(mContext) + new AlertDialog.Builder(getContext()) .setMessage(messageId) - .setPositiveButton(com.android.internal.R.string.VideoView_error_button, + .setPositiveButton(android.R.string.VideoView_error_button, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { /* If we get here, there is no onError listener, so @@ -484,7 +484,7 @@ public class CodeauroraVideoView extends SurfaceView implements MediaPlayerContr mMediaPlayer.setOnInfoListener(mOnInfoListener); mMediaPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener); mCurrentBufferPercentage = 0; - mMediaPlayer.setDataSource(mContext, mUri, mHeaders); + mMediaPlayer.setDataSource(getContext(), mUri, mHeaders); mMediaPlayer.setDisplay(mSurfaceHolder); mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mMediaPlayer.setScreenOnWhilePlaying(true); @@ -956,7 +956,7 @@ public class CodeauroraVideoView extends SurfaceView implements MediaPlayerContr private boolean isKeyguardLocked() { if (mKeyguardManager == null) { mKeyguardManager = - (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE); + (KeyguardManager) getContext().getSystemService(Context.KEYGUARD_SERVICE); } // isKeyguardSecure excludes the slide lock case. boolean locked = (mKeyguardManager != null) diff --git a/src/org/codeaurora/gallery3d/video/SettingsActivity.java b/src/org/codeaurora/gallery3d/video/SettingsActivity.java index 5928846a5..46ad6b5cf 100644 --- a/src/org/codeaurora/gallery3d/video/SettingsActivity.java +++ b/src/org/codeaurora/gallery3d/video/SettingsActivity.java @@ -1,6 +1,7 @@ package org.codeaurora.gallery3d.video; import android.app.ActionBar; +import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; @@ -17,6 +18,7 @@ import android.util.Log; import android.view.MenuItem; import org.codeaurora.gallery.R; +import com.android.gallery3d.common.ApiHelper; import com.android.gallery3d.common.ApiHelper.SystemProperties; import java.util.ArrayList; @@ -113,7 +115,6 @@ public class SettingsActivity extends PreferenceActivity { private String[] getOperatorNumeric() { ArrayList<String> result = new ArrayList<String>(); - String mccMncFromSim = null; if (mUseNvOperatorForEhrpd) { String mccMncForEhrpd = SystemProperties.get("ro.cdma.home.operator.numeric", null); if (mccMncForEhrpd != null && mccMncForEhrpd.length() > 0) { @@ -121,8 +122,9 @@ public class SettingsActivity extends PreferenceActivity { } } - mccMncFromSim = TelephonyManager.getDefault().getSimOperator(); - + TelephonyManager manager = (TelephonyManager) getApplicationContext() + .getSystemService(Context.TELEPHONY_SERVICE); + String mccMncFromSim = manager.getSimOperator(); if (mccMncFromSim != null && mccMncFromSim.length() > 0) { result.add(mccMncFromSim); } @@ -221,8 +223,9 @@ public class SettingsActivity extends PreferenceActivity { Intent intent = new Intent(Settings.ACTION_APN_SETTINGS); int subscription = 0; try { - subscription = Settings.Global.getInt(SettingsActivity.this.getContentResolver(), - Settings.Global.MULTI_SIM_DATA_CALL_SUBSCRIPTION); + subscription = Settings.Global.getInt( + SettingsActivity.this.getContentResolver(), + ApiHelper.MULTI_SIM_DATA_CALL_SUBSCRIPTION); } catch (Exception e) { Log.d("SettingActivity", "Can't get subscription for Exception: " + e); } finally { |
