summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
author Mark Renouf <mrenouf@google.com> 2023-09-12 19:57:07 -0400
committer Mark Renouf <mrenouf@google.com> 2023-09-13 00:24:15 +0000
commit7acb0306549d15d756aca1628fddc91a9bfc354a (patch)
tree7dd49703910b2bd21be8bbcd14339a3f96872e62 /java/src
parent42fbb1defed76e2f712195b088c34fdff12a764e (diff)
Remove obsolete code left over from the system process
None of this is necessary now that the activity is running in a normal application process. The 'name-based' version of getSharedPreferences works fine. Bug: 300157408 Flag: EXEMPT Test: manually; share content, long-press to pin/unpin; verify across usages and reboots Change-Id: Id056cd377babf397b323b40c52614cd326d5c79e
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/intentresolver/ChooserActivity.java17
1 files changed, 1 insertions, 16 deletions
diff --git a/java/src/com/android/intentresolver/ChooserActivity.java b/java/src/com/android/intentresolver/ChooserActivity.java
index 0101c046..ebe6f04b 100644
--- a/java/src/com/android/intentresolver/ChooserActivity.java
+++ b/java/src/com/android/intentresolver/ChooserActivity.java
@@ -51,11 +51,9 @@ import android.database.Cursor;
import android.graphics.Insets;
import android.net.Uri;
import android.os.Bundle;
-import android.os.Environment;
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.UserManager;
-import android.os.storage.StorageManager;
import android.service.chooser.ChooserTarget;
import android.util.Log;
import android.util.Slog;
@@ -100,7 +98,6 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import dagger.hilt.android.AndroidEntryPoint;
-import java.io.File;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.text.Collator;
@@ -421,19 +418,7 @@ public class ChooserActivity extends Hilt_ChooserActivity implements
}
static SharedPreferences getPinnedSharedPrefs(Context context) {
- // The code below is because in the android:ui process, no one can hear you scream.
- // The package info in the context isn't initialized in the way it is for normal apps,
- // so the standard, name-based context.getSharedPreferences doesn't work. Instead, we
- // build the path manually below using the same policy that appears in ContextImpl.
- // This fails silently under the hood if there's a problem, so if we find ourselves in
- // the case where we don't have access to credential encrypted storage we just won't
- // have our pinned target info.
- final File prefsFile = new File(new File(
- Environment.getDataUserCePackageDirectory(StorageManager.UUID_PRIVATE_INTERNAL,
- context.getUserId(), context.getPackageName()),
- "shared_prefs"),
- PINNED_SHARED_PREFS_NAME + ".xml");
- return context.getSharedPreferences(prefsFile, MODE_PRIVATE);
+ return context.getSharedPreferences(PINNED_SHARED_PREFS_NAME, MODE_PRIVATE);
}
@Override