Revert "Revert "Never strip and store dex files uncompressed when they are preopted on system.""

This reverts commit 67e8ec1973700bbdbc4cd68b3493d56d270ca377.

Test: build && atest android.text.cts.EmojiTest#testEmojiGlyphWebView on Cuttlefish
Exempt-From-Owner-Approval: Got +2 from Colin, latest PS is a rebase across conflicts.

Change-Id: I99faf0f2ec698d70c107516bd43756b9ddcb90d0
diff --git a/dexpreopt/dexpreopt_test.go b/dexpreopt/dexpreopt_test.go
index be86190..ecaf876 100644
--- a/dexpreopt/dexpreopt_test.go
+++ b/dexpreopt/dexpreopt_test.go
@@ -36,6 +36,7 @@
 	DefaultCompilerFilter:              "",
 	SystemServerCompilerFilter:         "",
 	GenerateDMFiles:                    false,
+	NeverAllowStripping:                false,
 	NoDebugInfo:                        false,
 	AlwaysSystemServerDebugInfo:        false,
 	NeverSystemServerDebugInfo:         false,
@@ -109,6 +110,22 @@
 	}
 }
 
+func TestDexPreoptStrip(t *testing.T) {
+	// Test that we panic if we strip in a configuration where stripping is not allowed.
+	global, module := testGlobalConfig, testModuleConfig
+
+	global.NeverAllowStripping = true
+	module.NoStripping = false
+	module.Name = "test"
+	module.DexLocation = "/system/app/test/test.apk"
+	module.BuildPath = "out/test/test.apk"
+
+	_, err := GenerateStripRule(global, module)
+	if err == nil {
+		t.Errorf("Expected an error when calling GenerateStripRule on a stripped module")
+	}
+}
+
 func TestDexPreoptSystemOther(t *testing.T) {
 	global, module := testGlobalConfig, testModuleConfig