[Settings] Support getSystemService(Class<T>)

Add getSystemService(Class<T>) to align the capability with framework
part.

Bug: 179640862
Test: local
Change-Id: I278951c2402aa8551cee37923f45626ab1830dd3
This commit is contained in:
Bonian Chen
2021-03-17 13:32:32 +08:00
parent d248042a02
commit 49cdb602ea

View File

@@ -438,6 +438,13 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
return getActivity().getSystemService(name); return getActivity().getSystemService(name);
} }
/**
* Returns the specified system service from the owning Activity.
*/
protected <T> T getSystemService(final Class<T> serviceClass) {
return getActivity().getSystemService(serviceClass);
}
/** /**
* Returns the PackageManager from the owning Activity. * Returns the PackageManager from the owning Activity.
*/ */