Package com.aurelienpierre.sioul
Class ShareActivity
java.lang.Object
android.content.Context
android.content.ContextWrapper
android.view.ContextThemeWrapper
android.app.Activity
com.aurelienpierre.sioul.ShareActivity
- All Implemented Interfaces:
ComponentCallbacks,ComponentCallbacks2,KeyEvent.Callback,LayoutInflater.Factory,LayoutInflater.Factory2,View.OnCreateContextMenuListener,Window.Callback
What other apps hand Sioul to write (docs/android.md, "Sharing"): files and
text shared to it, or to one of your addresses straight from the share
sheet (MailShortcuts), and mailto: links. Each becomes a request in Sioul's
data folder (
handed/incoming/<id>.json), which Rust makes a draft of as
its window comes up (crates/sioul-app/src/outside.rs); Sioul's window is
brought up at once.
Shared files come as content:// addresses that Sioul may read only while
this activity lives. They are opened on a thread of their own (a cloud's
app may fetch a file before it opens), then this activity ends, and the copy
goes on from the open files into handed/files/<id>/, under their own names,
while you write. When all are copied, handed/incoming/<id>.done.json says
where, and Rust is told (nativeHanded) to attach them. Never shown itself.
Not taken: a file named by its place (file://), and Sioul's own files,
which any app could otherwise ask Sioul to attach. Nothing is sent until
you press Send.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classA shared file, open, or why not.Nested classes/interfaces inherited from class android.app.Activity
Activity.ScreenCaptureCallbackNested classes/interfaces inherited from class android.content.Context
Context.BindServiceFlags -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final StringThe account a launcher's shortcut writes from (MailShortcuts).private static final intNames kept under this many bytes: Android's file names hold 255.private static final intMore files than this in one share are not taken.(package private) static final StringSioul's shortcuts for your addresses: "mail:" and the account's id.Fields inherited from class android.app.Activity
DEFAULT_KEYS_DIALER, DEFAULT_KEYS_DISABLE, DEFAULT_KEYS_SEARCH_GLOBAL, DEFAULT_KEYS_SEARCH_LOCAL, DEFAULT_KEYS_SHORTCUT, FOCUSED_STATE_SET, FULLSCREEN_MODE_REQUEST_ENTER, FULLSCREEN_MODE_REQUEST_EXIT, OVERRIDE_TRANSITION_CLOSE, OVERRIDE_TRANSITION_OPEN, RESULT_CANCELED, RESULT_FIRST_USER, RESULT_OKFields inherited from class android.content.Context
ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ADVANCED_PROTECTION_SERVICE, ALARM_SERVICE, APP_FUNCTION_SERVICE, APP_OPS_SERVICE, APP_SEARCH_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BATTERY_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_ACTIVITY_STARTS, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_EXTERNAL_SERVICE, BIND_EXTERNAL_SERVICE_LONG, BIND_IMPORTANT, BIND_INCLUDE_CAPABILITIES, BIND_NOT_FOREGROUND, BIND_NOT_PERCEPTIBLE, BIND_PACKAGE_ISOLATED_PROCESS, BIND_SHARED_ISOLATED_PROCESS, BIND_WAIVE_PRIORITY, BIOMETRIC_SERVICE, BLOB_STORE_SERVICE, BLUETOOTH_SERVICE, BUGREPORT_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CARRIER_CONFIG_SERVICE, CLIPBOARD_SERVICE, COMPANION_DEVICE_SERVICE, CONNECTIVITY_DIAGNOSTICS_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTACT_KEYS_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, CREDENTIAL_SERVICE, CROSS_PROFILE_APPS_SERVICE, DEVICE_ID_DEFAULT, DEVICE_ID_INVALID, DEVICE_LOCK_SERVICE, DEVICE_POLICY_SERVICE, DISPLAY_HASH_SERVICE, DISPLAY_SERVICE, DOMAIN_VERIFICATION_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, EUICC_SERVICE, FILE_INTEGRITY_SERVICE, FINGERPRINT_SERVICE, GAME_SERVICE, GRAMMATICAL_INFLECTION_SERVICE, HARDWARE_PROPERTIES_SERVICE, HEALTHCONNECT_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, IPSEC_SERVICE, JOB_SCHEDULER_SERVICE, KEYGUARD_SERVICE, KEYSTORE_SERVICE, LAUNCHER_APPS_SERVICE, LAYOUT_INFLATER_SERVICE, LOCALE_SERVICE, LOCATION_SERVICE, MEDIA_COMMUNICATION_SERVICE, MEDIA_METRICS_SERVICE, MEDIA_PROJECTION_SERVICE, MEDIA_QUALITY_SERVICE, MEDIA_ROUTER_SERVICE, MEDIA_SESSION_SERVICE, MIDI_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_NO_LOCALIZED_COLLATORS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_STATS_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, OVERLAY_SERVICE, PEOPLE_SERVICE, PERFORMANCE_HINT_SERVICE, PERSISTENT_DATA_BLOCK_SERVICE, POWER_SERVICE, PRINT_SERVICE, PROFILING_SERVICE, RECEIVER_EXPORTED, RECEIVER_NOT_EXPORTED, RECEIVER_VISIBLE_TO_INSTANT_APPS, RESTRICTIONS_SERVICE, ROLE_SERVICE, SATELLITE_SERVICE, SEARCH_SERVICE, SECURITY_STATE_SERVICE, SENSOR_SERVICE, SHORTCUT_SERVICE, STATUS_BAR_SERVICE, STORAGE_SERVICE, STORAGE_STATS_SERVICE, SYSTEM_HEALTH_SERVICE, TELECOM_SERVICE, TELEPHONY_IMS_SERVICE, TELEPHONY_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE, TETHERING_SERVICE, TEXT_CLASSIFICATION_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TV_AD_SERVICE, TV_INPUT_SERVICE, TV_INTERACTIVE_APP_SERVICE, UI_MODE_SERVICE, USAGE_STATS_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_MANAGER_SERVICE, VIBRATOR_SERVICE, VIRTUAL_DEVICE_SERVICE, VPN_MANAGEMENT_SERVICE, WALLPAPER_SERVICE, WIFI_AWARE_SERVICE, WIFI_P2P_SERVICE, WIFI_RTT_RANGING_SERVICE, WIFI_SERVICE, WINDOW_SERVICEFields inherited from interface android.content.ComponentCallbacks2
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringThe account chosen: an address of yours in the share sheet, or a launcher's shortcut; "" for Sioul's usual one.(package private) static StringA name a file can have in Sioul's folder, as close to the app's as can be: no "/" nor hidden dot, not too long, and an extension from its type when it has none (Sioul tells the recipient a file's type by it).private voidOn a thread of its own: each file opened, then this activity let go (its permission with it: the files stay open), then each copied, then Rust told.private static String"Sioul could not take what you shared: …", in the phone's language, asDoseAlarms.words(int)picks it: Rust's words are not loaded yet.(package private) static FileWhere Rust takes what is handed (sioul_core::handed): XDG_DATA_HOME/sioul/handed (android/main.cpp).private static Stringprivate static Stringname(ContentResolver resolver, Uri uri) A file's name as its app gives it, else the end of its address.(package private) static voidRust told that something was handed (android/main.cpp, outside.rs).protected voidprivate voidopen()Sioul's window brought up, as by its icon.private static JSONObjectWhat Rust reads (sioul_core::handed::Handed).private static voidstore(AssetFileDescriptor file, File folder, File copy) A file copied whole, or not at all: under ".part" until it is.The files shared: EXTRA_STREAM, one or a list, each once.private static JSONArrayAddresses, however the app gave them: one, an array, a list.private booleanWhether a shared address is taken: a content:// one, of another app's provider.private static voidtell()Rust told, when Sioul's library is loaded (its window up); else it takes the request as the window comes up.private static StringA text, however the app gave it: a string, styled text, a list of them (one per paragraph).(package private) static String"photo.jpg", then "photo (2).jpg" for a second of the same name.private static voidAn address of yours chosen in the share sheet: Android ranks it higher next time.private static StringWhy it failed, in the system's words, without Java's class names.(package private) static voidA text written whole: under another name, then renamed.Methods inherited from class android.app.Activity
addContentView, attachBaseContext, clearOverrideActivityTransition, closeContextMenu, closeOptionsMenu, createPendingResult, dismissDialog, dismissKeyboardShortcutsHelper, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, dump, enterPictureInPictureMode, enterPictureInPictureMode, findViewById, finish, finishActivity, finishActivityFromChild, finishAffinity, finishAfterTransition, finishAndRemoveTask, finishFromChild, getActionBar, getApplication, getCaller, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getContentScene, getContentTransitionManager, getCurrentCaller, getCurrentFocus, getFragmentManager, getInitialCaller, getIntent, getLastNonConfigurationInstance, getLaunchedFromPackage, getLaunchedFromUid, getLayoutInflater, getLoaderManager, getLocalClassName, getMaxNumPictureInPictureActions, getMediaController, getMenuInflater, getOnBackInvokedDispatcher, getParent, getParentActivityIntent, getPreferences, getReferrer, getRequestedOrientation, getSearchEvent, getSplashScreen, getSystemService, getTaskId, getTitle, getTitleColor, getVoiceInteractor, getVolumeControlStream, getWindow, getWindowManager, hasWindowFocus, invalidateOptionsMenu, isActivityTransitionRunning, isChangingConfigurations, isChild, isDestroyed, isFinishing, isImmersive, isInMultiWindowMode, isInPictureInPictureMode, isLaunchedFromBubble, isLocalVoiceInteractionSupported, isTaskRoot, isVoiceInteraction, isVoiceInteractionRoot, managedQuery, moveTaskToBack, navigateUpTo, navigateUpToFromChild, onActionModeFinished, onActionModeStarted, onActivityReenter, onActivityResult, onActivityResult, onApplyThemeResource, onAttachedToWindow, onAttachFragment, onBackPressed, onChildTitleChanged, onConfigurationChanged, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreate, onCreateContextMenu, onCreateDescription, onCreateDialog, onCreateDialog, onCreateNavigateUpTaskStack, onCreateOptionsMenu, onCreatePanelMenu, onCreatePanelView, onCreateThumbnail, onCreateView, onCreateView, onDestroy, onDetachedFromWindow, onEnterAnimationComplete, onGenericMotionEvent, onGetDirectActions, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onLocalVoiceInteractionStarted, onLocalVoiceInteractionStopped, onLowMemory, onMenuItemSelected, onMenuOpened, onMultiWindowModeChanged, onMultiWindowModeChanged, onNavigateUp, onNavigateUpFromChild, onNewIntent, onNewIntent, onOptionsItemSelected, onOptionsMenuClosed, onPanelClosed, onPause, onPerformDirectAction, onPictureInPictureModeChanged, onPictureInPictureModeChanged, onPictureInPictureRequested, onPictureInPictureUiStateChanged, onPostCreate, onPostCreate, onPostResume, onPrepareDialog, onPrepareDialog, onPrepareNavigateUpTaskStack, onPrepareOptionsMenu, onPreparePanel, onProvideAssistContent, onProvideAssistData, onProvideKeyboardShortcuts, onProvideReferrer, onRequestPermissionsResult, onRequestPermissionsResult, onRestart, onRestoreInstanceState, onRestoreInstanceState, onResume, onRetainNonConfigurationInstance, onSaveInstanceState, onSaveInstanceState, onSearchRequested, onSearchRequested, onStart, onStateNotSaved, onStop, onTitleChanged, onTopResumedActivityChanged, onTouchEvent, onTrackballEvent, onTrimMemory, onUserInteraction, onUserLeaveHint, onVisibleBehindCanceled, onWindowAttributesChanged, onWindowFocusChanged, onWindowStartingActionMode, onWindowStartingActionMode, openContextMenu, openOptionsMenu, overrideActivityTransition, overrideActivityTransition, overridePendingTransition, overridePendingTransition, postponeEnterTransition, recreate, registerActivityLifecycleCallbacks, registerComponentCallbacks, registerForContextMenu, registerScreenCaptureCallback, releaseInstance, removeDialog, reportFullyDrawn, requestDragAndDropPermissions, requestFullscreenMode, requestOpenInBrowserEducation, requestPermissions, requestPermissions, requestShowKeyboardShortcuts, requestVisibleBehind, requestWindowFeature, requireViewById, runOnUiThread, setActionBar, setAllowCrossUidActivitySwitchFromBelow, setContentTransitionManager, setContentView, setContentView, setContentView, setDefaultKeyMode, setEnterSharedElementCallback, setExitSharedElementCallback, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setFinishOnTouchOutside, setImmersive, setInheritShowWhenLocked, setIntent, setIntent, setLocusContext, setMediaController, setPictureInPictureParams, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRecentsScreenshotEnabled, setRequestedOrientation, setResult, setResult, setSecondaryProgress, setShouldDockBigOverlays, setShowWhenLocked, setTaskDescription, setTheme, setTitle, setTitle, setTitleColor, setTranslucent, setTurnScreenOn, setVisible, setVolumeControlStream, setVrModeEnabled, shouldDockBigOverlays, shouldShowRequestPermissionRationale, shouldShowRequestPermissionRationale, shouldUpRecreateTask, showAssist, showDialog, showDialog, showLockTaskEscapeMessage, startActionMode, startActionMode, startActivities, startActivities, startActivity, startActivity, startActivityForResult, startActivityForResult, startActivityFromChild, startActivityFromChild, startActivityFromFragment, startActivityFromFragment, startActivityIfNeeded, startActivityIfNeeded, startIntentSender, startIntentSender, startIntentSenderForResult, startIntentSenderForResult, startIntentSenderFromChild, startIntentSenderFromChild, startLocalVoiceInteraction, startLockTask, startManagingCursor, startNextMatchingActivity, startNextMatchingActivity, startPostponedEnterTransition, startSearch, stopLocalVoiceInteraction, stopLockTask, stopManagingCursor, takeKeyEvents, triggerSearch, unregisterActivityLifecycleCallbacks, unregisterComponentCallbacks, unregisterForContextMenu, unregisterScreenCaptureCallbackMethods inherited from class android.view.ContextThemeWrapper
applyOverrideConfiguration, getAssets, getResources, getTheme, setThemeMethods inherited from class android.content.ContextWrapper
bindIsolatedService, bindService, bindService, bindService, bindService, bindServiceAsUser, bindServiceAsUser, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingOrSelfUriPermissions, checkCallingPermission, checkCallingUriPermission, checkCallingUriPermissions, checkContentUriPermissionFull, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, checkUriPermissions, clearWallpaper, createAttributionContext, createConfigurationContext, createContext, createContextForSplit, createDeviceContext, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, createWindowContext, createWindowContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAttributionSource, getAttributionTag, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDatabasePath, getDataDir, getDeviceId, getDir, getDisplay, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFilesDir, getFileStreamPath, getMainExecutor, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getOpPackageName, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getParams, getSharedPreferences, getSystemServiceName, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isDeviceProtectedStorage, isRestricted, isUiContext, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerDeviceIdChangeListener, registerReceiver, registerReceiver, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeSelfPermissionsOnKill, revokeUriPermission, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setWallpaper, setWallpaper, startForegroundService, startInstrumentation, startService, stopService, unbindService, unregisterDeviceIdChangeListener, unregisterReceiver, updateServiceGroupMethods inherited from class android.content.Context
bindIsolatedService, getColor, getColorStateList, getDrawable, getString, getString, getSystemService, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, revokeSelfPermissionOnKill, sendBroadcastWithMultiplePermissionsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface android.view.Window.Callback
onPointerCaptureChanged
-
Field Details
-
ACCOUNT
The account a launcher's shortcut writes from (MailShortcuts).- See Also:
-
PREFIX
Sioul's shortcuts for your addresses: "mail:" and the account's id.- See Also:
-
MOST
More files than this in one share are not taken.- See Also:
-
LONGEST
Names kept under this many bytes: Android's file names hold 255.- See Also:
-
-
Constructor Details
-
ShareActivity
public ShareActivity()
-
-
Method Details
-
nativeHanded
Rust told that something was handed (android/main.cpp, outside.rs). -
onCreate
-
handed
Where Rust takes what is handed (sioul_core::handed): XDG_DATA_HOME/sioul/handed (android/main.cpp). Not the drafts' folder: the sharing carries that one to your other devices, and a request is this phone's. -
failed
"Sioul could not take what you shared: …", in the phone's language, asDoseAlarms.words(int)picks it: Rust's words are not loaded yet. -
open
Sioul's window brought up, as by its icon. -
tell
Rust told, when Sioul's library is loaded (its window up); else it takes the request as the window comes up. -
used
An address of yours chosen in the share sheet: Android ranks it higher next time. -
request
private static JSONObject request(Intent intent, String id, int files, JSONArray refused) throws JSONException What Rust reads (sioul_core::handed::Handed).- Throws:
JSONException
-
account
The account chosen: an address of yours in the share sheet, or a launcher's shortcut; "" for Sioul's usual one. -
strings
Addresses, however the app gave them: one, an array, a list. -
text
A text, however the app gave it: a string, styled text, a list of them (one per paragraph). -
streams
The files shared: EXTRA_STREAM, one or a list, each once. Not the clip's addresses: beside a text, an app may put there the picture the share sheet shows, which is no attachment. -
taken
Whether a shared address is taken: a content:// one, of another app's provider. Not a file:// one, nor one of Sioul's own providers: any app could name Sioul's private files that way, to have them attached. -
lastPart
-
copy
On a thread of its own: each file opened, then this activity let go (its permission with it: the files stay open), then each copied, then Rust told. -
store
A file copied whole, or not at all: under ".part" until it is. The open file closed after.- Throws:
IOException
-
name
A file's name as its app gives it, else the end of its address. -
cleaned
A name a file can have in Sioul's folder, as close to the app's as can be: no "/" nor hidden dot, not too long, and an extension from its type when it has none (Sioul tells the recipient a file's type by it). -
unique
"photo.jpg", then "photo (2).jpg" for a second of the same name. -
why
Why it failed, in the system's words, without Java's class names. -
write
A text written whole: under another name, then renamed.- Throws:
IOException
-