[android] Fix a crash in Bundle.getParcelable()

Partially revert b2da0b5e

See #143

Signed-off-by: Roman Tsisyk <roman@tsisyk.com>
This commit is contained in:
Roman Tsisyk 2023-03-01 11:17:02 +02:00 committed by Viktor Govako
parent 9651d426fc
commit 20367ce7cd
3 changed files with 2 additions and 14 deletions

View file

@ -960,7 +960,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
intent.hasExtra(EXTRA_TASK) &&
((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0))
{
final MapTask mapTask = Utils.getSerializable(intent, EXTRA_TASK, MapTask.class);
final MapTask mapTask = (MapTask) intent.getSerializableExtra(EXTRA_TASK);
mTasks.add(mapTask);
intent.removeExtra(EXTRA_TASK);

View file

@ -74,7 +74,7 @@ public abstract class BaseMwmFragmentActivity extends AppCompatActivity
// An intent that was skipped due to core wasn't initialized has to be used
// as a target intent for this activity, otherwise all input extras will be lost
// in a splash activity loop.
Intent initialIntent = Utils.getParcelable(getIntent(), SplashActivity.EXTRA_INITIAL_INTENT, Intent.class);
Intent initialIntent = getIntent().getParcelableExtra(SplashActivity.EXTRA_INITIAL_INTENT);
if (initialIntent != null)
setIntent(initialIntent);

View file

@ -814,12 +814,6 @@ public class Utils
return (T) args.getParcelable(key);
}
@Nullable
public static <T> T getParcelable(@NonNull Intent intent, String key, Class<T> clazz)
{
final Bundle args = intent.getExtras();
return (args == null) ? null : getParcelable(args, key, clazz);
}
@Nullable
public static <T> T getParcelable(@NonNull Bundle args, String key, Class<T> clazz)
@ -846,12 +840,6 @@ public class Utils
return args.getSerializable(key, clazz);
}
@Nullable
public static <T extends Serializable> T getSerializable(@NonNull Intent intent, String key, Class<T> clazz)
{
final Bundle args = intent.getExtras();
return (args == null) ? null : getSerializable(args, key, clazz);
}
@SuppressWarnings("deprecation")
private static Spanned fromHtmlOld(@NonNull String htmlDescription)