EditInfoActivity.java revision 5874835f1edc1cac42eb4b3aa5fe437e8fd53c78
1/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package com.android.emergency.edit;
17
18import static android.view.WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD;
19
20import android.app.Activity;
21import android.content.Intent;
22import android.os.Bundle;
23
24import com.android.emergency.EmergencyTabPreferenceActivity;
25import com.android.internal.logging.MetricsLogger;
26import com.android.internal.logging.MetricsProto.MetricsEvent;
27/**
28 * Activity for editing emergency information.
29 */
30public class EditInfoActivity extends EmergencyTabPreferenceActivity {
31    @Override
32    protected void onCreate(Bundle savedInstanceState) {
33        super.onCreate(savedInstanceState);
34        getWindow().addFlags(FLAG_DISMISS_KEYGUARD);
35        MetricsLogger.visible(this, MetricsEvent.ACTION_EDIT_EMERGENCY_INFO);
36    }
37
38    @Override
39    public boolean isInViewMode() {
40        return false;
41    }
42
43    @Override
44    public void onBackPressed() {
45        // If returning to the ViewInfoActivity, then the currently selected tab will be shown.
46        Intent resultIntent = new Intent();
47        resultIntent.putExtra(EXTRA_SELECTED_TAB, getSelectedTabPosition());
48        setResult(Activity.RESULT_OK, resultIntent);
49        finish();
50    }
51}
52