Commit 8b80976d authored by Sinan Sahin's avatar Sinan Sahin Committed by Commit Bot

Update direct share titles for a11y

Currently, the direct share icon content descriptions are set to the
application name. This causes issues if an app has multiple activities
that can be used to share. E.g. The Drive app has "Save to Drive" and
"Copy to clipboard," but TalkBack reads them both as "share via Drive."

As a fix, this CL changes ShareHelper#getShareableIconAndName to return
the activity label instead of the app label. If the activity label is
null, the app label is returned by default.

Bug: 986545
Change-Id: I1174ca962deb9efbe25c432967c60f68ea855e20
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1721854Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: Sinan Sahin <sinansahin@google.com>
Cr-Commit-Position: refs/heads/master@{#682386}
parent 8db2c4b1
...@@ -17,7 +17,6 @@ import android.content.Intent; ...@@ -17,7 +17,6 @@ import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
...@@ -564,8 +563,7 @@ public class ShareHelper { ...@@ -564,8 +563,7 @@ public class ShareHelper {
// https://crbug.com/729737 // https://crbug.com/729737
try (StrictModeContext ignored = StrictModeContext.allowDiskReads()) { try (StrictModeContext ignored = StrictModeContext.allowDiskReads()) {
directShareIcon = pm.getActivityIcon(component); directShareIcon = pm.getActivityIcon(component);
ApplicationInfo ai = pm.getApplicationInfo(component.getPackageName(), 0); directShareTitle = pm.getActivityInfo(component, 0).loadLabel(pm);
directShareTitle = pm.getApplicationLabel(ai);
} }
retrieved = true; retrieved = true;
} catch (NameNotFoundException exception) { } catch (NameNotFoundException exception) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment