Removing various reflection calls with final APIs

Change-Id: Ibf48d6015d808f86bc79ccf64e3077eb5b6ccaff
This commit is contained in:
Sunny Goyal
2017-05-18 15:03:13 -07:00
parent 8bca47adc5
commit 22ca9ec137
11 changed files with 138 additions and 270 deletions
@@ -37,8 +37,6 @@ import com.android.launcher3.LauncherSettings;
import com.android.launcher3.R;
import com.android.launcher3.ShortcutInfo;
import java.lang.reflect.Method;
/**
* Wrapper class for representing a shortcut configure activity.
*/
@@ -151,15 +149,13 @@ public abstract class ShortcutConfigActivityInfo {
if (getUser().equals(Process.myUserHandle())) {
return super.startConfigActivity(activity, requestCode);
}
IntentSender is = activity.getSystemService(LauncherApps.class)
.getShortcutConfigActivityIntent(mInfo);
try {
Method m = LauncherApps.class.getDeclaredMethod(
"getShortcutConfigActivityIntent", LauncherActivityInfo.class);
IntentSender is = (IntentSender) m.invoke(
activity.getSystemService(LauncherApps.class), mInfo);
activity.startIntentSenderForResult(is, requestCode, null, 0, 0, 0);
return true;
} catch (Exception e) {
Log.e(TAG, "Error calling new API", e);
} catch (IntentSender.SendIntentException e) {
Toast.makeText(activity, R.string.activity_not_found, Toast.LENGTH_SHORT).show();
return false;
}
}