auto import from //depot/cupcake/@135843
diff --git a/src/com/android/stk/StkApp.java b/src/com/android/stk/StkApp.java
new file mode 100644
index 0000000..ebd52b1
--- /dev/null
+++ b/src/com/android/stk/StkApp.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.stk;
+
+import android.app.Application;
+
+import com.android.internal.telephony.gsm.stk.Duration;
+
+/**
+ * Top-level Application class for STK app.
+ */
+abstract class StkApp extends Application {
+ // Application constants
+ public static final boolean DBG = true;
+
+ // Identifiers for option menu items
+ static final int MENU_ID_END_SESSION = android.view.Menu.FIRST;
+ static final int MENU_ID_BACK = android.view.Menu.FIRST + 1;
+ static final int MENU_ID_HELP = android.view.Menu.FIRST + 2;
+
+ // UI timeout, 30 seconds - used for display dialog and activities.
+ static final int UI_TIMEOUT = (40 * 1000);
+
+ // Tone default timeout - 2 seconds
+ static final int TONE_DFEAULT_TIMEOUT = (2 * 1000);
+
+ public static final String TAG = "STK App";
+
+ /**
+ * This function calculate the time in MS from a duration instance.
+ * returns zero when duration is null.
+ */
+ public static int calculateDurationInMilis(Duration duration) {
+ int timeout = 0;
+ if (duration != null) {
+ switch (duration.timeUnit) {
+ case MINUTE:
+ timeout = 1000 * 60;
+ break;
+ case TENTH_SECOND:
+ timeout = 1000 * 10;
+ break;
+ case SECOND:
+ default:
+ timeout = 1000;
+ break;
+ }
+ timeout *= duration.timeInterval;
+ }
+ return timeout;
+ }
+}