From 10b34a5ebf12e97ecba0caf3c8e30b476b038a96 Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Thu, 4 May 2017 08:23:17 -0700 Subject: Update Dialer to V10 RC16 This release was created following the instructions at: go/dialer-aosp-release Subsequent dialer releases will follow as O bugs are fixed, until we reach our final RC. Version: 10 Candidate: RC16 Branch: dialer-android_release_branch/153304843.1 dialer-android/dialer-android_20170416.00/dialer-android_20170416.00_RC16 This release contains the following bug fixes since RC00: Bug: 37324705 35304403 36067503 35304446 33203808 37280992 37346084 35766990 37481880 37424493 36470282 37347691 37519015 37168472 35805360 37545472 27704934 36515614 35766990 37577470 34739750 35801628 36788693 35264204 36708536 37628370 36904650 37314436 37642171 37530847 37637799 37666625 37548549 37648036 37636412 37323529 37630507 35919141 37198343 37548572 36178218 37640315 37663896 37720467 37275944 37710497 31634477 37744796 37348506 37744796 37568534 37672424 34872683 34873026 37681461 34873295 37748373 37526812 37618638 37663896 37536088 37727455 37165687 36651204 36900708 37323529 36902926 37256480 37328353 37432034 37436952 34093562 37720889 37321935 37780300 37781115 37755902 36588206 34258266 37290464 37698062 37618638 37473004 37432034 37918676 37870494 37722091 Test: make, on device Change-Id: I99e1a484ccd578c1f8a13e7a6a4b4952f0791297 --- .../dialer/callintent/CallIntentParser.java | 25 ++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'java/com/android/dialer/callintent') diff --git a/java/com/android/dialer/callintent/CallIntentParser.java b/java/com/android/dialer/callintent/CallIntentParser.java index b54f7c78b..01afce06d 100644 --- a/java/com/android/dialer/callintent/CallIntentParser.java +++ b/java/com/android/dialer/callintent/CallIntentParser.java @@ -19,32 +19,35 @@ package com.android.dialer.callintent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; -import com.android.dialer.common.Assert; -import com.google.protobuf.InvalidProtocolBufferException; +import com.android.dialer.protos.ProtoParsers; /** Parses data for a call extra to get any dialer specific app data. */ public class CallIntentParser { + static final String EXTRA_CALL_SPECIFIC_APP_DATA_WRAPPER = + "com.android.dialer.callintent.CALL_SPECIFIC_APP_DATA_WRAPPER"; @Nullable public static CallSpecificAppData getCallSpecificAppData(@Nullable Bundle extras) { if (extras == null) { return null; } - byte[] flatArray = extras.getByteArray(Constants.EXTRA_CALL_SPECIFIC_APP_DATA); - if (flatArray == null) { - return null; - } - try { - return CallSpecificAppData.parseFrom(flatArray); - } catch (InvalidProtocolBufferException e) { - Assert.fail("unexpected exception: " + e); + if (!extras.containsKey(Constants.EXTRA_CALL_SPECIFIC_APP_DATA)) { return null; } + + return ProtoParsers.getTrusted( + extras.getBundle(Constants.EXTRA_CALL_SPECIFIC_APP_DATA), + EXTRA_CALL_SPECIFIC_APP_DATA_WRAPPER, + CallSpecificAppData.getDefaultInstance()); } public static void putCallSpecificAppData( @NonNull Bundle extras, @NonNull CallSpecificAppData callSpecificAppData) { - extras.putByteArray(Constants.EXTRA_CALL_SPECIFIC_APP_DATA, callSpecificAppData.toByteArray()); + // We wrap our bundle for consumers that may not have access to ProtoParsers in their class + // loader. This is necessary to prevent ClassNotFoundException's + Bundle wrapperBundle = new Bundle(); + ProtoParsers.put(wrapperBundle, EXTRA_CALL_SPECIFIC_APP_DATA_WRAPPER, callSpecificAppData); + extras.putBundle(Constants.EXTRA_CALL_SPECIFIC_APP_DATA, wrapperBundle); } private CallIntentParser() {} -- cgit v1.2.3