Merge "Use old API only if no share targets are published"
This commit is contained in:
committed by
Android (Google) Code Review
commit
c8dfe98014
@@ -76,4 +76,6 @@ interface IShortcutService {
|
||||
|
||||
// System API used by framework's ShareSheet (ChooserActivity)
|
||||
ParceledListSlice getShareTargets(String packageName, in IntentFilter filter, int userId);
|
||||
|
||||
boolean hasShareTargets(String packageName, String packageToCheck, int userId);
|
||||
}
|
||||
@@ -635,4 +635,21 @@ public class ShortcutManager {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by framework's ShareSheet (ChooserActivity.java) to check if a given package has share
|
||||
* target definitions in it's resources.
|
||||
*
|
||||
* @param packageName Package to check for share targets.
|
||||
* @return True if the package has any share target definitions, False otherwise.
|
||||
* @hide
|
||||
*/
|
||||
public boolean hasShareTargets(@NonNull String packageName) {
|
||||
try {
|
||||
return mService.hasShareTargets(mContext.getPackageName(), packageName,
|
||||
injectMyUserId());
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user