Move MediaStore.java inside APEX boundary.

Recent work has paved the way to get MediaStore.java building against
"core_platform", and this change is actually shifting MediaStore.java
inside the MediaProvider APEX boundary.

This involves defining a new "updatable-mediaprovider" library JAR
and ensuring that it's spliced into classpaths where needed to keep
everything building and working.

Note that the MediaProvider APK itself is still bundled, so we're
manually including the MediaStore.java when building that APK so that
we can continue referencing @hide symbols, but there's a STOPSHIP
comment to remove that once we get the APK building against
"system_current".

Bug: 144247087
Test: atest --test-mapping packages/providers/MediaProvider
Change-Id: I6d6da165848b934f4ca7ecfca7b97de6f97897e3
This commit is contained in:
Jeff Sharkey 2019-12-15 22:05:02 -07:00 committed by Jeff Sharkey
parent ddb6485b64
commit 38338a951d
3 changed files with 23 additions and 0 deletions

View file

@ -52,6 +52,7 @@ func init() {
AddNeverAllowRules(createTrebleRules()...)
AddNeverAllowRules(createLibcoreRules()...)
AddNeverAllowRules(createMediaRules()...)
AddNeverAllowRules(createMediaProviderRules()...)
AddNeverAllowRules(createJavaDeviceForHostRules()...)
}
@ -160,6 +161,14 @@ func createMediaRules() []Rule {
}
}
func createMediaProviderRules() []Rule {
return []Rule{
NeverAllow().
With("libs", "framework-mediaprovider").
Because("framework-mediaprovider includes private APIs. Use framework_mediaprovider_stubs instead."),
}
}
func createJavaDeviceForHostRules() []Rule {
javaDeviceForHostProjectsWhitelist := []string{
"external/guava",

View file

@ -202,6 +202,19 @@ var neverallowTests = []struct {
"updatable-media includes private APIs. Use updatable_media_stubs instead.",
},
},
{
name: "dependency on framework-mediaprovider",
fs: map[string][]byte{
"Android.bp": []byte(`
java_library {
name: "needs_framework_mediaprovider",
libs: ["framework-mediaprovider"],
}`),
},
expectedErrors: []string{
"framework-mediaprovider includes private APIs. Use framework_mediaprovider_stubs instead.",
},
},
{
name: "java_device_for_host",
fs: map[string][]byte{

View file

@ -47,6 +47,7 @@ var (
"core-oj",
"core-libart",
"updatable-media",
"framework-mediaprovider",
"ike",
}
)