Home | History | Annotate | Download | only in exchange
      1 /*
      2  * Copyright (C) 2008-2009 Marc Blank
      3  * Licensed to The Android Open Source Project.
      4  *
      5  * Licensed under the Apache License, Version 2.0 (the "License");
      6  * you may not use this file except in compliance with the License.
      7  * You may obtain a copy of the License at
      8  *
      9  *      http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  * Unless required by applicable law or agreed to in writing, software
     12  * distributed under the License is distributed on an "AS IS" BASIS,
     13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  * See the License for the specific language governing permissions and
     15  * limitations under the License.
     16  */
     17 
     18 package com.android.exchange;
     19 
     20 import android.util.Log;
     21 
     22 /**
     23  * Constants used throughout the EAS implementation are stored here.
     24  *
     25  */
     26 public class Eas {
     27     // For debugging
     28     public static boolean WAIT_DEBUG = false;   // DO NOT CHECK IN WITH THIS SET TO TRUE
     29     public static boolean DEBUG = false;         // DO NOT CHECK IN WITH THIS SET TO TRUE
     30 
     31     // The following two are for user logging (the second providing more detail)
     32     public static boolean USER_LOG = false;     // DO NOT CHECK IN WITH THIS SET TO TRUE
     33     public static boolean PARSER_LOG = false;   // DO NOT CHECK IN WITH THIS SET TO TRUE
     34     public static boolean FILE_LOG = false;     // DO NOT CHECK IN WITH THIS SET TO TRUE
     35 
     36     public static final int DEBUG_BIT = 1;
     37     public static final int DEBUG_EXCHANGE_BIT = 2;
     38     public static final int DEBUG_FILE_BIT = 4;
     39 
     40     public static final String VERSION = "0.3";
     41     public static final String ACCOUNT_MAILBOX_PREFIX = "__eas";
     42 
     43     // Define our default protocol version as 2.5 (Exchange 2003)
     44     public static final String SUPPORTED_PROTOCOL_EX2003 = "2.5";
     45     public static final double SUPPORTED_PROTOCOL_EX2003_DOUBLE = 2.5;
     46     public static final String SUPPORTED_PROTOCOL_EX2007 = "12.0";
     47     public static final double SUPPORTED_PROTOCOL_EX2007_DOUBLE = 12.0;
     48     public static final String DEFAULT_PROTOCOL_VERSION = SUPPORTED_PROTOCOL_EX2003;
     49 
     50     // From EAS spec
     51     //                Mail Cal
     52     // 0 No filter    Yes  Yes
     53     // 1 1 day ago    Yes  No
     54     // 2 3 days ago   Yes  No
     55     // 3 1 week ago   Yes  No
     56     // 4 2 weeks ago  Yes  Yes
     57     // 5 1 month ago  Yes  Yes
     58     // 6 3 months ago No   Yes
     59     // 7 6 months ago No   Yes
     60 
     61     public static final String FILTER_ALL = "0";
     62     public static final String FILTER_1_DAY = "1";
     63     public static final String FILTER_3_DAYS = "2";
     64     public static final String FILTER_1_WEEK = "3";
     65     public static final String FILTER_2_WEEKS = "4";
     66     public static final String FILTER_1_MONTH = "5";
     67     public static final String FILTER_3_MONTHS = "6";
     68     public static final String FILTER_6_MONTHS = "7";
     69     public static final String BODY_PREFERENCE_TEXT = "1";
     70     public static final String BODY_PREFERENCE_HTML = "2";
     71 
     72     // For EAS 12, we use HTML, so we want a larger size than in EAS 2.5
     73     public static final String EAS12_TRUNCATION_SIZE = "200000";
     74     // For EAS 2.5, truncation is a code; the largest is "7", which is 100k
     75     public static final String EAS2_5_TRUNCATION_SIZE = "7";
     76 
     77     public static final int FOLDER_STATUS_OK = 1;
     78     public static final int FOLDER_STATUS_INVALID_KEY = 9;
     79 
     80     public static final int EXCHANGE_ERROR_NOTIFICATION = 0x10;
     81 
     82     public static void setUserDebug(int state) {
     83         // DEBUG takes precedence and is never true in a user build
     84         if (!DEBUG) {
     85             USER_LOG = (state & DEBUG_BIT) != 0;
     86             PARSER_LOG = (state & DEBUG_EXCHANGE_BIT) != 0;
     87             FILE_LOG = (state & DEBUG_FILE_BIT) != 0;
     88             if (FILE_LOG || PARSER_LOG) {
     89                 USER_LOG = true;
     90             }
     91             Log.d("Eas Debug", "Logging: " + (USER_LOG ? "User " : "") +
     92                     (PARSER_LOG ? "Parser " : "") + (FILE_LOG ? "File" : ""));
     93         }
     94      }
     95 }
     96