mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1234629 - Part 0: Make Distribution look in /data/data/$PACKAGE/distribution last. r=rnewman
Call a distribution in /data/data/$PACKAGE/distribution a "data distribution". Right now we read data distributions only in response to writing them via another code path (extracting from APK, or downloading). We don't recognize a data distribution in the same way that we recognize a system distribution (in /system/.../distribution) in the Java code, simply because we don't look for it; and I haven't investigated, but I think that Gecko may in fact recognize a data distribution in this case. This patch simply recognizes data distributions after looking for other distributions. That way data distributions written by the bouncer APK are recognized and initialized, but not given precedence over other distribution channels.
This commit is contained in:
parent
5f4e1f9723
commit
45d70f711a
@ -463,11 +463,13 @@ public class Distribution {
|
||||
return true;
|
||||
}
|
||||
|
||||
// We try the install intent, then the APK, then the system directory.
|
||||
// We try to find the install intent, then the APK, then the system directory, and finally
|
||||
// an already copied distribution. Already copied might originate from the bouncer APK.
|
||||
final boolean distributionSet =
|
||||
checkIntentDistribution(referrer) ||
|
||||
copyAndCheckAPKDistribution() ||
|
||||
checkSystemDistribution();
|
||||
checkSystemDistribution() ||
|
||||
checkDataDistribution();
|
||||
|
||||
// If this is our first run -- and thus we weren't already in STATE_NONE or STATE_SET above --
|
||||
// and we didn't find a distribution already, then we should hold on to callbacks in case we
|
||||
|
@ -137,6 +137,8 @@ public class testDistribution extends ContentProviderTest {
|
||||
|
||||
// Pre-clear distribution pref, run basic preferences and en-US localized preferences Tests
|
||||
clearDistributionPref();
|
||||
clearDistributionFromDataData();
|
||||
|
||||
setTestLocale("en-US");
|
||||
try {
|
||||
initDistribution(mockPackagePath);
|
||||
@ -154,6 +156,7 @@ public class testDistribution extends ContentProviderTest {
|
||||
|
||||
// Pre-clear distribution pref, and run es-MX localized preferences Test
|
||||
clearDistributionPref();
|
||||
clearDistributionFromDataData();
|
||||
setTestLocale("es-MX");
|
||||
initDistribution(mockPackagePath);
|
||||
checkLocalizedPreferences("es-MX");
|
||||
@ -161,9 +164,11 @@ public class testDistribution extends ContentProviderTest {
|
||||
// Test the (stubbed) download interaction.
|
||||
setTestLocale("en-US");
|
||||
clearDistributionPref();
|
||||
clearDistributionFromDataData();
|
||||
doTestValidReferrerIntent();
|
||||
|
||||
clearDistributionPref();
|
||||
clearDistributionFromDataData();
|
||||
doTestInvalidReferrerIntent();
|
||||
}
|
||||
|
||||
@ -503,6 +508,22 @@ public class testDistribution extends ContentProviderTest {
|
||||
TestableDistribution.clearReferrerDescriptorForTesting();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears any distribution found in /data/data.
|
||||
*/
|
||||
private void clearDistributionFromDataData() throws Exception {
|
||||
File dataDir = new File(mActivity.getApplicationInfo().dataDir);
|
||||
|
||||
// Recursively delete distribution files that Distribution.init copied to data directory.
|
||||
File distDir = new File(dataDir, "distribution");
|
||||
if (distDir.exists()) {
|
||||
mAsserter.dumpLog("Clearing distribution from " + distDir.getAbsolutePath());
|
||||
delete(distDir);
|
||||
} else {
|
||||
mAsserter.dumpLog("No distribution to clear from " + distDir.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
// TODO: Set up the content provider after setting the distribution.
|
||||
@ -527,10 +548,7 @@ public class testDistribution extends ContentProviderTest {
|
||||
File mockPackage = new File(dataDir, MOCK_PACKAGE);
|
||||
mAsserter.ok(mockPackage.delete(), "clean up mock package", "deleted " + mockPackage.getPath());
|
||||
|
||||
// Recursively delete distribution files that Distribution.init copied to data directory.
|
||||
File distDir = new File(dataDir, "distribution");
|
||||
delete(distDir);
|
||||
|
||||
clearDistributionFromDataData();
|
||||
clearDistributionPref();
|
||||
|
||||
super.tearDown();
|
||||
|
Loading…
Reference in New Issue
Block a user