AOSP/Email - Second part of the Security Vulnerability fix -
  Email App: Malicious app is able to compose message with hidden
  attachments and bypass attachments path checks attaching private files
  from /data/data/com.android.email/*

+ Ported the following CLs. Code is different from gmail. Made the changes
  to work with Email.
  ++ https://critique.corp.google.com/#review/136780360
     +++ Differentiating our Compose intents from other app's intent.
	 Added ComposeActivityEmailExternal method and it always returns true.
         Treat body and quoted text as plaintext if intent is external.

Bug: 32068883
Bug: 32502421
Bug: 32589229

Test: manual - Ran the following tests on Pixel phone. Tested the Email UI.

$ adb install -r out/target/product/marlin/system/app/Email/Email.apk

$ adb install -r  app-debug.apk
   Success

$ adb shell am start -n com.test.poc.poc32589229/.MainActivity -a android.intent.action.MAIN
  Starting: Intent { act=android.intent.action.MAIN cmp=com.test.poc.poc32589229/.MainActivity }

  Duplicated the steps in https://b.corp.google.com/issues/32589229#comment5
  and didn't get the attachments after the fix (was getting attachments before the fix).

$ adb install -r out/target/product/marlin/testcases/EmailTests/EmailTests.apk
  Performing Streamed Install
  Success

$ adb shell am instrument -w com.android.email.tests
  The number of failures are same as before (with or without this change).
  Tests run: 158,  Failures: 5

Change-Id: I4eda17af7f60e1c92f49ffa6025b328f6481ec76
(cherry picked from commit c87d04b8c190f52c4f7e8a22dfaa2b5e065415fe)
2 files changed